Showing posts with label android. Show all posts
Showing posts with label android. Show all posts
Monday, June 20, 2011
Eclipse is becoming increasingly annoying
As an Android developer I find Eclipse these days is becoming very unreliable. All of a sudden all my projects would not compile. I tried doing a project-> clean and build but still the error console would not tell me what is wrong. I had not made changes to any of the files. The only message I got was "Your project has errors, please fix it before trying the build".. very helpful right. The I thought let me try using my favorite IDE for all these years Netbeans, I have not done any Android projects using this super hero so a 30 sec googling is all that took to setup the environment and I imported my projects and there it is the proper error message your "com.android.sdklib.build.ApkCreationException: Debug Certificate expired on 6/18/11 11:25 PM". Thank you netbeans you are amazing.
Thursday, December 23, 2010
Parcelable interface in android
The most efficient way to pass custom objects between android activities in by implementing the Parcelable interface. Two methods describeContents and writeToParcel needs to be overridden
In this example MyParcel class has a name and a list of emails which we would like write to a parcel so that other activities can have access to it. As you can see the basic java types have their corresponding write methods to write a user defined class or a list we first create a bundle and then write it to the parcel.
public class MyParcel implements Parcelable{
private String name;
private List emails;
@Override
public int describeContents() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void writeToParcel(Parcel dest, int arg1) {
dest.writeString(name);
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("emails", emails);
dest.writeBundle(bundle);
}
}
In this example MyParcel class has a name and a list of emails which we would like write to a parcel so that other activities can have access to it. As you can see the basic java types have their corresponding write methods to write a user defined class or a list we first create a bundle and then write it to the parcel.
Subscribe to:
Posts (Atom)