Wednesday, December 12, 2012


Android Google MapView Tutorial'


http://codemagician.wordpress.com/2010/05/06/android-google-mapview-tutorial-done-right/

Tuesday, June 19, 2012

How to sign an android apk and zip align:

1. Right click your project in eclipse and Click Android tools – > export unsigned apk.
    Give it a name and save it in a directory.


 
2. Copy the File (eg: Myapp.apk) into "D:\Android\Android\android-sdk\tools"

3. Go to command prompt:
       To generate a key-store:
         -  keytool -genkey -v -keystore mykeystore.keystore -alias mykey -keyalg RSA -validity 10000




 3. Then generate the sign apk. and the zip align command


D:\Android\Android\android-sdk\platform-tools>keytool -genkey -v -keystore mykey
store.keystore -alias mykey -keyalg RSA -validity 10000
Enter keystore password:
Keystore password is too short - must be at least 6 characters

Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  yuva rajan
What is the name of your organizational unit?
  [Unknown]:  mobile team
What is the name of your organization?
  [Unknown]:  evoke technologies
What is the name of your City or Locality?
  [Unknown]:  hyd
What is the name of your State or Province?
  [Unknown]:  andhara pradesh
What is the two-letter country code for this unit?
  [Unknown]:  hyd
Is CN=yuva rajan, OU=mobile team, O=evoke technologies, L=hyd, ST=andhara prades
h, C=hyd correct?
  [no]:  y

Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with
 a validity of 10,000 days
        for: CN=yuva rajan, OU=mobile team, O=evoke technologies, L=hyd, ST=andh
ara pradesh, C=hyd
Enter key password for 
        (RETURN if same as keystore password):
Re-enter new password:(yuvarajan)
[Storing mykeystore.keystore]



D:\Android\Android\android-sdk\platform-tools>jarsigner -verbose -keystore mykey
store.keystore GenericApp.apk mykey
Enter Passphrase for keystore:(yuvarajan)


D:\Android\Android\android-sdk\tools>zipalign -v 4 GenericApp.apk GenericApp_New
.apk
Verifying alignment of GenericApp_New.apk (4)...
Reference Url:
http://www.coderzheaven.com/2011/11/26/steps-to-sign-an-android-apk-and-publish-it-to-the-market/

Monday, June 11, 2012

Android WebView Back Button:

      To handle the BACK button key press, add the following method inside the WebViewActivity Activity:


public class WebViewActivity extends Activity {
    /** Called when the activity is first created. */ 
 
 WebView web;
  
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        web = (WebView) findViewById(R.id.webview01);
        web.setWebViewClient(new myWebClient());
        web.getSettings().setJavaScriptEnabled(true);
        web.loadUrl("http://www.google.co.uk");
    }
    
    public class myWebClient extends WebViewClient
    {
     @Override
     public void onPageStarted(WebView view, String url, Bitmap favicon) {
      // TODO Auto-generated method stub
      super.onPageStarted(view, url, favicon);
     }
     
     @Override
     public boolean shouldOverrideUrlLoading(WebView view, String url) {
      // TODO Auto-generated method stub
      
      view.loadUrl(url);
      return true;
      
     }
    }
    
    // To handle "Back" key press event for WebView to go back to previous screen.
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) 
 {
  if ((keyCode == KeyEvent.KEYCODE_BACK) && web.canGoBack()) {
   web.goBack();
   return true;
  }
  return super.onKeyDown(keyCode, event);
 }
}