Displaying keyword search results 41 - 50
Created by freyo on April 06, 2011 14:58:43 Last update: May 05, 2011 14:52:49
To view certificate in CERT.RSA :
C:\tmp>openssl pkcs7 -inform DER -in CERT.RSA -noo...To convert certificate to PEM:
openssl pkcs7 -inform DER -in CERT.RSA -out CERT.p...Java keytool also works:
$ keytool -printcert -file CERT.RSA Owner: EMA...
Created by freyo on April 12, 2011 15:13:32 Last update: May 03, 2011 15:20:55
Create new project
$ tools/android create project \ > --package co...Edit res/values/string.xml , add strings for the main screen.
<?xml version="1.0" encoding="utf-8"?> <resourc...Add widgets to main layout ( res/layout/main.xml ).
<?xml version="1.0" encoding="utf-8"?> <LinearL...Edit src/com/android/apkinfo/GetAPKPermissions.java and change contents to:
package com.android.apkinfo; import android...Install the debug package to the emulator:
ant installThe screen should look like: Add display permissions activity. Start by creating a new layout res/layout/display_permissions.xml :
<?xml version="1.0" encoding="utf-8"?> <LinearL...Add the strings used by the new Activity ( res/values/strings.xml ):
<?xml version="1.0" encoding="utf-8"?> <resourc...Add the Display Permissions Activity ( src/com/android/apkinfo/DisplayPermissions.java ):
package com.android.apkinfo; import android...Change src/com/android/apkinfo/GetAPKPermissions.java to invoke the Display Permissions Activity:
package com.android.apkinfo; import android...Declare Display Permissions Activity in AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?> <manifes......
Created by Dr. Xi on April 27, 2011 11:57:36 Last update: April 27, 2011 11:58:35
This is a sample struts-config.xml file for Struts 1.x .
<?xml version="1.0" encoding="UTF-8"?> <!DO...
Created by Dr. Xi on April 26, 2011 21:25:55 Last update: April 27, 2011 11:08:57
The following code validates a web.xml file against the web-app 2.5 schema:
// Java XML validation with schema import java....web.xml used for testing:
<?xml version="1.0" encoding="UTF-8"?> <web-ap...According to Java API doc , validation can also be done while parsing by calling setSchema on the parsing factory. However, validation doesn't work for the SAXParserFactory!
// Java XML validation with schema import java....
Created by freyo on April 20, 2011 12:26:08 Last update: April 20, 2011 12:26:08
When you create a new key with Java keytool , it wraps the public key in a self signed certificate. You can generate a certificate signing request with the keytool -certreq command. After a certificate authority (CA) signs the certificate request, you can import the certificate received (a .crt file) back into the key store. Instead of using a CA, you can sign the certificate request with another key (with openssl, for example). If the certificate is not signed by a CA, you'll receive an error:
$ keytool -import -alias android-root -file androi...To fix the problem, import the certificate of the signer:
$ keytool -import -trustcacerts -file openssl.crt ...Import the certificate again (alias is the alias of the private key whose certificate was...
Created by freyo on April 18, 2011 15:08:21 Last update: April 18, 2011 15:12:20
Generate android project
$ ~/android-sdk-linux_86/tools/android create proj...Create XML file res/xml/books.xml :
<?xml version="1.0"?> <catalog> <book id=...Edit layout ( res/layout/main.xml ):
<?xml version="1.0" encoding="utf-8"?> <Lin...Edit code ( src/com/android/xmlres/XMLResource.java ):
package com.android.xmlres; import java.io....Change activity label from app_name to booklist ( AndroidManifest.xml ):
<?xml version="1.0" encoding="utf-8"?> <manifes...Add value for string resource ( res/values/string.xml ):
<?xml version="1.0" encoding="utf-8"?> <resourc...Deploy and test:
Created by freyo on April 18, 2011 14:14:29 Last update: April 18, 2011 14:15:48
For XML resources, Android returns an XmlPullParser reference. I tried the RSSReader example from xmlpull.org , it failed both on the Android emulator and with xpp3-1.1.4c . This is an example for XmlPullParser usage. Since the XmlPullParser is event based, a callback mechanism works better. Java code:
import java.io.*; import java.net.*; import ...The XML file used:
<?xml version="1.0" encoding="UTF-8"?> <catalog...
Created by freyo on April 15, 2011 09:00:54 Last update: April 15, 2011 09:00:54
Sample code for writing to a file in the internal storage. There are three steps: Open the file with Context.openFileOutput , which returns java.io.FileOutputStream . Write to the file. Close the file.
import java.io.*; import android.content.Contex...The second parameter to openFileOutput is the operating mode. Available values are: Context.MODE_PRIVATE Context.MODE_APPEND Context.MODE_WORLD_READABLE Context.MODE_WORLD_WRITEABLE The file is saved in /data/data/<package_name>/files .
Created by alfa on April 08, 2011 12:33:08 Last update: April 08, 2011 12:33:08
This example captures the screen of the current Java application window, instead of the full screen.
import java.io.*; import java.awt.*; import ...
Created by alfa on April 08, 2011 11:05:24 Last update: April 08, 2011 11:05:24
Key points: Use java.awt.Robot to capture a screen region as java.awt.image.BufferedImage . Use javax.imageio.ImageIO to write image out to a file.
import java.awt.AWTException; import java.awt.R...