Tuesday, July 9, 2013

Admob error in Eclipse? - Android


Eclipse is showing an error in android:configChanges line in my AndroidManifest.xml:

<activity android:name="com.google.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"></activity>
and the error is,
error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').

I resolved it by setting target=android-13 in project.properties file.. After changing it don't forget to do Project-> Clean 

If you would like to know how to make use of Admob in your Android app, you can take a look at this tutorial..

http://www.monkeycoder.co.nz/Community/posts.php?topic=1121

APK signed with a certificate that is not yet valid - Android?

While publishing the app I got the below error,

"You uploaded an APK signed with a certificate that is not yet valid. You need to sign your APK with a certificate that is currently valid."

After several Google searches, I resolved this issue by changing the system date of the computer.. I changed my system date to some earlier date, generated a new keystore and uploaded the app.. it worked like a charm :)


Tuesday, July 2, 2013

How to start an activity if the user clicks on OK button in AlertDialog - Android?

Make use of this code to start an activity if the user clicks on OK button in AlertDialog,

AlertDialog.Builder alertDialog = new AlertDialog.Builder(Someclass.this);
    builder.setMessage("Are you sure you want to quit?")    alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {  
    public void onClick(DialogInterface dialog, int which) { 
        Intent myIntent = new Intent(((Dialog) dialog).getContext(), Someclass2.class);        startActivity(myIntent);    
        return;  
        }        
    })
    .setNegativeButton("Cancel", new DialogInterface.OnClickListener(){
        public void onClick(DialogInterface dialog, int which) {
             // Do Nothing
     }

    alertDialog.show();