Parcelable序列化对象自动生成器

1.一个序列化生成器,直接可以用http://parcelabler.com/

2.另外一个第三方的Parcelable代码生成器,挺好用的

  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.

猜你喜欢

转载自762626559-qq-com.iteye.com/blog/1959219