Here's a typical implementation of a Parcelable class: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/content/ComponentName.java
(Don't worry about the static writeToParcel() or readFromParcel() methods, those are a special optimization that you won't use.) On Thu, Oct 8, 2009 at 2:36 PM, Stefan <[email protected]> wrote: > > hi, > > i don't find a good tutorial for that. I don't get behind the idea of > this. But i want to understand it because in my opinion, this is the > "cleanest" way?? > A dirty but perhaps an easier idea is to implement a "String > getTrackPoint()" function and save this in a Bundle. But i think, this > isnt the best way for responsiveness (because the String could contain > f.e. 1000 <trkpt lat="xx" lon="yy"/> lines). > > In my class, the both important variables are: > > private StringBuilder wpt, trkpt. If the location changed in my main > app, they get the new lat/lon values. And later, if I finish tracking, > i call sh.saveFile() and i generate a gpx file with: > gpx.append(wpt); > gpx.append(trkpt); > out.write(gpx.toString()); //BufferedWriter > > Must I only add "implements Parcelable" in my class definition and add > something like that: > > public void writeToParcel(Parcel out, int flags) > { > out.???? > } > > public static final Parcelable.Creator ???? CREATOR = > new Parcelable.Creator ???? > { > public ???? createFromParcel(Parcel in) > { > ???? > } > @Override > public ??? newArray(int size) > { > return new ????[size]; > } > }; > > must i add a StringBuffer Array for my class (perhaps write > StringBuffer [] instead of ???? ) > And in the onSaveInstanceState - function, i only have to add > saveInstanceState.putParcelable("sh", sh); ??? > > > If my question is to complex to understand, you must not answer me. > > > Thanks, > Stefan > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

