parcelabler: for implementing Android’s Parcelable interface

I have created a tool for making the methods needed for implementation of Android’s Parcelable interface within a pre-existing class.

  1. Open the parcelabler tool.
  2. Copy the full code of the class into the “Code” text field.
    Example code:

    public class Photo {
        /**
         * Caption for the photo
         */
        public String caption;
        public int commentCount;
        public long photoId;
        public boolean isDefault;
        public Bundle metadata;
        public CommentHandler commentHandler;
    }
    
  3. Click “Build” to create the methods
  4. Copy the methods into your class
  5. Add “implements Parcelable” to your class definition
Now you should hopefully have a working implementation of Parcelable in your class.

5 thoughts on “parcelabler: for implementing Android’s Parcelable interface

  1. gulyasm

    Great tool! One observation. You could generate the code for the unknown types too. You could assume they implement the Parcelable interface, and have the public static CREATOR member, and generete code for them as well. If there is any error, generating for those types too solves the problem. I did the above for my own parcelable tool. Though I don’t have this cool interface like yours. :)

    Reply
  2. Ev

    u should fix the parcelabler so it could handle the 2 or more dimensional array.
    for example:
    int [][]v;

    Reply

Leave a Reply