Convert Class from Serializable to Parcelable

Put your problem here if it does not fit any of the other categories.

Convert Class from Serializable to Parcelable

Postby gilgantic » Fri Mar 14, 2008 8:18 pm

Hi All,

I was looking for a simple example on how to create Parcelable class. I currently have my class as a Serializable, but I experience and discovered in my reading that Parcelable is much faster than Serializable when passing between Activities in android.os.Bundle. Could someone show me how to write these two classes below as Parcelable classes?

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class ClassA implements Serializable {
  2.  
  3.     public long _Id;
  4.  
  5.     public ClassB classB;
  6.  
  7.     public java.util.Date date;
  8.  
  9.     public int anInteger;
  10.  
  11.     public String aString;
  12.  
  13. }
  14.  
  15.  
  16.  
  17. public class ClassB implements Serializable {
  18.  
  19.     public String aString;
  20.  
  21. }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Thanks!
gilgantic
gilgantic
Freshman
Freshman
 
Posts: 6
Joined: Sun Feb 24, 2008 11:08 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 15 guests