[android-developers] Re: Object Serialization
I have never tried storing an ArrayList into SQLite myself, but you could try storing it as BLOB Datatype. That should store the object exactly as is is (in theory). Good luck! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: object serialization ???
thank you all :) you were right: the only solution is to remove my class from beeing an inner class. thanks a lot. greetings, darolla 2009/2/11 Mattaku Betsujin mattaku.betsu...@gmail.com: The problem is you're trying to serialize an inner class of SerialisiereAndroidActivity, which is not Serializable. To fix this, you can declar the inner class as public static class Serialisiere implements ^^^ - Mattaku On Tue, Feb 10, 2009 at 11:56 AM, dlawogus...@gmail.com dlawogus...@gmail.com wrote: Hello darolla, I have not tested your code to be certain about this but I would say u would actually need to instantiate your object like so instead of passing the static reference because the object u create in your code contains states (your instance vars) but the static reference does not. Serialisiere s = new Serialisirer(1,2,3) oos.writeObject(s) On Feb 10, 5:50 am, Chechy che...@gmail.com wrote: Hi, I've tried several ways but the only way I succeeded to serialize something is to serialize each member of class Serialisiere: public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeInt(this.i); oos.writeDouble(this.d); oos.writeChars(this.s); oos.close(); fos.close(); } I'm not sure if this answers your question. Best Regards: Chechy On Feb 10, 11:55 am, DaRolla netzprofi.ma...@googlemail.com wrote: hi, I get nuts on this, who can help? package de.test; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class SerialisiereAndroidActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { Serialisiere pi = new Serialisiere(3, Math.PI, pi); ((TextView) findViewById(R.id.tv1)).setText(Serialisiere:+ pi.toString()); pi.writeIt(pi.ser); } catch( Exception e) { Log.d( SerialisiereAndroidActivity, e.toString() ); } } public class Serialisiere implements Serializable { private static final long serialVersionUID = -3922493985071195239L; private int i; private double d; private String s; public Serialisiere(int i, double d, String s) { this.i = i; this.d = d; this.s = s; } public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(Serialisiere.this); oos.close(); fos.close(); } @Override public String toString() { return i= + i + d= + d + s= + s; } } } the problem is: oos.writeObject(Serialisiere.this); this throws an java.io.NotSerializableException. who can help me on this? greetings, darolla --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: object serialization ???
maybe I didnt explain enough :) so what I want to is to serialize an Object in order to deserialize it later on. but its not that easy. I think the way I try to write is ok. but why do i get that exception? its only an in, a double and a string inside that object. greetings, darolla 2009/2/10 DaRolla netzprofi.ma...@googlemail.com: hi, I get nuts on this, who can help? package de.test; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class SerialisiereAndroidActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { Serialisiere pi = new Serialisiere(3, Math.PI, pi); ((TextView) findViewById(R.id.tv1)).setText(Serialisiere: + pi.toString()); pi.writeIt(pi.ser); } catch( Exception e) { Log.d( SerialisiereAndroidActivity, e.toString() ); } } public class Serialisiere implements Serializable { private static final long serialVersionUID = -3922493985071195239L; private int i; private double d; private String s; public Serialisiere(int i, double d, String s) { this.i = i; this.d = d; this.s = s; } public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(Serialisiere.this); oos.close(); fos.close(); } @Override public String toString() { return i= + i + d= + d + s= + s; } } } the problem is: oos.writeObject(Serialisiere.this); this throws an java.io.NotSerializableException. who can help me on this? greetings, darolla --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: object serialization ???
Hi, I've tried several ways but the only way I succeeded to serialize something is to serialize each member of class Serialisiere: public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeInt(this.i); oos.writeDouble(this.d); oos.writeChars(this.s); oos.close(); fos.close(); } I'm not sure if this answers your question. Best Regards: Chechy On Feb 10, 11:55 am, DaRolla netzprofi.ma...@googlemail.com wrote: hi, I get nuts on this, who can help? package de.test; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class SerialisiereAndroidActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { Serialisiere pi = new Serialisiere(3, Math.PI, pi); ((TextView) findViewById(R.id.tv1)).setText(Serialisiere: + pi.toString()); pi.writeIt(pi.ser); } catch( Exception e) { Log.d( SerialisiereAndroidActivity, e.toString() ); } } public class Serialisiere implements Serializable { private static final long serialVersionUID = -3922493985071195239L; private int i; private double d; private String s; public Serialisiere(int i, double d, String s) { this.i = i; this.d = d; this.s = s; } public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(Serialisiere.this); oos.close(); fos.close(); } @Override public String toString() { return i= + i + d= + d + s= + s; } } } the problem is: oos.writeObject(Serialisiere.this); this throws an java.io.NotSerializableException. who can help me on this? greetings, darolla --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: object serialization ???
Hi, I've tried several ways to get it work but the only way I found is to serialize all members of the class: public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeInt(this.i); oos.writeDouble(this.d); oos.writeChars(this.s); oos.close(); fos.close(); } I know that this is not the way but ... Best Regards: Chechy On Feb 10, 11:55 am, DaRolla netzprofi.ma...@googlemail.com wrote: hi, I get nuts on this, who can help? package de.test; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class SerialisiereAndroidActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { Serialisiere pi = new Serialisiere(3, Math.PI, pi); ((TextView) findViewById(R.id.tv1)).setText(Serialisiere: + pi.toString()); pi.writeIt(pi.ser); } catch( Exception e) { Log.d( SerialisiereAndroidActivity, e.toString() ); } } public class Serialisiere implements Serializable { private static final long serialVersionUID = -3922493985071195239L; private int i; private double d; private String s; public Serialisiere(int i, double d, String s) { this.i = i; this.d = d; this.s = s; } public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(Serialisiere.this); oos.close(); fos.close(); } @Override public String toString() { return i= + i + d= + d + s= + s; } } } the problem is: oos.writeObject(Serialisiere.this); this throws an java.io.NotSerializableException. who can help me on this? greetings, darolla --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: object serialization ???
Hello darolla, I have not tested your code to be certain about this but I would say u would actually need to instantiate your object like so instead of passing the static reference because the object u create in your code contains states (your instance vars) but the static reference does not. Serialisiere s = new Serialisirer(1,2,3) oos.writeObject(s) On Feb 10, 5:50 am, Chechy che...@gmail.com wrote: Hi, I've tried several ways but the only way I succeeded to serialize something is to serialize each member of class Serialisiere: public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeInt(this.i); oos.writeDouble(this.d); oos.writeChars(this.s); oos.close(); fos.close(); } I'm not sure if this answers your question. Best Regards: Chechy On Feb 10, 11:55 am, DaRolla netzprofi.ma...@googlemail.com wrote: hi, I get nuts on this, who can help? package de.test; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class SerialisiereAndroidActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { Serialisiere pi = new Serialisiere(3, Math.PI, pi); ((TextView) findViewById(R.id.tv1)).setText(Serialisiere: + pi.toString()); pi.writeIt(pi.ser); } catch( Exception e) { Log.d( SerialisiereAndroidActivity, e.toString() ); } } public class Serialisiere implements Serializable { private static final long serialVersionUID = -3922493985071195239L; private int i; private double d; private String s; public Serialisiere(int i, double d, String s) { this.i = i; this.d = d; this.s = s; } public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(Serialisiere.this); oos.close(); fos.close(); } @Override public String toString() { return i= + i + d= + d + s= + s; } } } the problem is: oos.writeObject(Serialisiere.this); this throws an java.io.NotSerializableException. who can help me on this? greetings, darolla --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: object serialization ???
The problem is you're trying to serialize an inner class of SerialisiereAndroidActivity, which is not Serializable. To fix this, you can declar the inner class as public static class Serialisiere implements ^^^ - Mattaku On Tue, Feb 10, 2009 at 11:56 AM, dlawogus...@gmail.com dlawogus...@gmail.com wrote: Hello darolla, I have not tested your code to be certain about this but I would say u would actually need to instantiate your object like so instead of passing the static reference because the object u create in your code contains states (your instance vars) but the static reference does not. Serialisiere s = new Serialisirer(1,2,3) oos.writeObject(s) On Feb 10, 5:50 am, Chechy che...@gmail.com wrote: Hi, I've tried several ways but the only way I succeeded to serialize something is to serialize each member of class Serialisiere: public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeInt(this.i); oos.writeDouble(this.d); oos.writeChars(this.s); oos.close(); fos.close(); } I'm not sure if this answers your question. Best Regards: Chechy On Feb 10, 11:55 am, DaRolla netzprofi.ma...@googlemail.com wrote: hi, I get nuts on this, who can help? package de.test; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class SerialisiereAndroidActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { Serialisiere pi = new Serialisiere(3, Math.PI, pi); ((TextView) findViewById(R.id.tv1)).setText(Serialisiere:+ pi.toString()); pi.writeIt(pi.ser); } catch( Exception e) { Log.d( SerialisiereAndroidActivity, e.toString() ); } } public class Serialisiere implements Serializable { private static final long serialVersionUID = -3922493985071195239L; private int i; private double d; private String s; public Serialisiere(int i, double d, String s) { this.i = i; this.d = d; this.s = s; } public void writeIt(String filename) throws IOException { FileOutputStream fos = openFileOutput(filename, MODE_WORLD_WRITEABLE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(Serialisiere.this); oos.close(); fos.close(); } @Override public String toString() { return i= + i + d= + d + s= + s; } } } the problem is: oos.writeObject(Serialisiere.this); this throws an java.io.NotSerializableException. who can help me on this? greetings, darolla --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Object serialization
I have to send data over Http connection after serializing it. I set the data in JSON object that will be sent via Http connection.Is converting the data in JSON object a way to serialize it or I need to have a class which extends Serializable?? On Oct 8, 10:31 pm, hackbod [EMAIL PROTECTED] wrote: Parcelable is much much more efficient than Serializable, but you should NOT use it for storing data to persistent storage as described in the Parcel dochttp://code.google.com/android/reference/android/os/Parcel.html Of course how much depends entirely on the objects involved, but a 100x difference wouldn't be unexpected. On Oct 8, 3:18 am, Guillaume Perrot [EMAIL PROTECTED] wrote: When passing objects in a Bundle, is a Parcelable more efficient than a Serializable ? How much ? On Oct 8, 2:32 am, Josh Roesslein [EMAIL PROTECTED] wrote: It might be okay to useserializationin services since they would normally run for a long period. Probably the only thing on the Android that would be long lived. On Tue, Oct 7, 2008 at 7:26 PM, hackbod [EMAIL PROTECTED] wrote: On a phone, I would argue there is pretty much no such thing as a long- lived application. The use of a handheld device is just fundamentally different than a desktop. Even the browser, though you may sometimes spend a lot of time in it, very often you are quickly popping in and out of it. Add in all of the interruptions (SMS, e-mail, chats, phone calls, etc) and the fact that with such a small screen you can only see one app at a time and with such few resources you can only actually have a few apps running in the background at a time... and startup time is pretty important. Plus, keep in mind that flipping open the keyboard means destroying the current activity and starting a new instance of it. As such, you really really don't want to do slow things in Activity.onCreate() or anything it depends on, and would very much be best off avoiding serializationthere. You can somewhat mitigate slow startup times here by caching data in your process, using the Activity APIs to transfer state across instances, etc... but best is to just design your app up-front to have a fast startup time, benefiting many important interactions the user has with it. On Oct 7, 5:11 pm, Josh Roesslein [EMAIL PROTECTED] wrote: For a short lived application startup time would be important. But for a long lived application that isn't restarted often it isn't as important. I never likedserializationanyways. There is better and faster ways to persist your application's state to disk. On Tue, Oct 7, 2008 at 6:54 PM, hackbod [EMAIL PROTECTED] wrote: Startup is actually one of the most performance critical parts of an application, since it directly impacts how quickly the user can move to your application from somewhere else, and if that takes a noticeable amount of time (you really want to keep it 1 second) then they are much less likely to use your app. On Oct 7, 3:33 pm, Josh Roesslein [EMAIL PROTECTED] wrote: Yeah I'm not sure how the performance ofserializationis on the Dalvik VM. If you are just usingserializationduring startup/shutdown speed shouldn't matter too much. But if you are loading/unloading objects a lot during the runtime of the application, it might be a bit sluggish. On Tue, Oct 7, 2008 at 5:17 PM, hackbod [EMAIL PROTECTED] wrote: It does support it, but I would generally recommend against it because Javaserializationis slow. It's hard to address the original question because there are basically no details. On Oct 7, 2:34 pm, Josh Roesslein [EMAIL PROTECTED] wrote: I believe Android's Java VM fully supports JavaSerialization. Trying Googling for javaserialization and you should find plenty of tutorials to get you started. On Tue, Oct 7, 2008 at 9:57 AM, Nemat [EMAIL PROTECTED] wrote: Hi, Can anyone tell me aboutobjectserializationin Android?? Thanks in Advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com 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 -~--~~~~--~~--~--~---
[android-developers] Re: Object serialization
JSON or any other platform neutral serialization is good.Using Serializable means you will only be able to communicate with Java peers really. Using Parcels would be wrong here, even if you are communicating with other Androids: I do not know much about that implementation, but different devices could run different versions of Android, which might completely break it. In my experience, something human readable makes debugging stuff going over the wire just so much easier, so JSON is great. Ludwig 2008/10/11 Nemat [EMAIL PROTECTED] I have to send data over Http connection after serializing it. I set the data in JSON object that will be sent via Http connection.Is converting the data in JSON object a way to serialize it or I need to have a class which extends Serializable?? On Oct 8, 10:31 pm, hackbod [EMAIL PROTECTED] wrote: Parcelable is much much more efficient than Serializable, but you should NOT use it for storing data to persistent storage as described in the Parcel dochttp:// code.google.com/android/reference/android/os/Parcel.html Of course how much depends entirely on the objects involved, but a 100x difference wouldn't be unexpected. On Oct 8, 3:18 am, Guillaume Perrot [EMAIL PROTECTED] wrote: When passing objects in a Bundle, is a Parcelable more efficient than a Serializable ? How much ? On Oct 8, 2:32 am, Josh Roesslein [EMAIL PROTECTED] wrote: It might be okay to useserializationin services since they would normally run for a long period. Probably the only thing on the Android that would be long lived. On Tue, Oct 7, 2008 at 7:26 PM, hackbod [EMAIL PROTECTED] wrote: On a phone, I would argue there is pretty much no such thing as a long- lived application. The use of a handheld device is just fundamentally different than a desktop. Even the browser, though you may sometimes spend a lot of time in it, very often you are quickly popping in and out of it. Add in all of the interruptions (SMS, e-mail, chats, phone calls, etc) and the fact that with such a small screen you can only see one app at a time and with such few resources you can only actually have a few apps running in the background at a time... and startup time is pretty important. Plus, keep in mind that flipping open the keyboard means destroying the current activity and starting a new instance of it. As such, you really really don't want to do slow things in Activity.onCreate() or anything it depends on, and would very much be best off avoiding serializationthere. You can somewhat mitigate slow startup times here by caching data in your process, using the Activity APIs to transfer state across instances, etc... but best is to just design your app up-front to have a fast startup time, benefiting many important interactions the user has with it. On Oct 7, 5:11 pm, Josh Roesslein [EMAIL PROTECTED] wrote: For a short lived application startup time would be important. But for a long lived application that isn't restarted often it isn't as important. I never likedserializationanyways. There is better and faster ways to persist your application's state to disk. On Tue, Oct 7, 2008 at 6:54 PM, hackbod [EMAIL PROTECTED] wrote: Startup is actually one of the most performance critical parts of an application, since it directly impacts how quickly the user can move to your application from somewhere else, and if that takes a noticeable amount of time (you really want to keep it 1 second) then they are much less likely to use your app. On Oct 7, 3:33 pm, Josh Roesslein [EMAIL PROTECTED] wrote: Yeah I'm not sure how the performance ofserializationis on the Dalvik VM. If you are just usingserializationduring startup/shutdown speed shouldn't matter too much. But if you are loading/unloading objects a lot during the runtime of the application, it might be a bit sluggish. On Tue, Oct 7, 2008 at 5:17 PM, hackbod [EMAIL PROTECTED] wrote: It does support it, but I would generally recommend against it because Javaserializationis slow. It's hard to address the original question because there are basically no details. On Oct 7, 2:34 pm, Josh Roesslein [EMAIL PROTECTED] wrote: I believe Android's Java VM fully supports JavaSerialization. Trying Googling for javaserialization and you should find plenty of tutorials to get you started. On Tue, Oct 7, 2008 at 9:57 AM, Nemat [EMAIL PROTECTED] wrote: Hi, Can anyone tell me aboutobjectserializationin Android?? Thanks in Advance --~--~-~--~~~---~--~~ You
[android-developers] Re: Object serialization
When passing objects in a Bundle, is a Parcelable more efficient than a Serializable ? How much ? On Oct 8, 2:32 am, Josh Roesslein [EMAIL PROTECTED] wrote: It might be okay to use serialization in services since they would normally run for a long period. Probably the only thing on the Android that would be long lived. On Tue, Oct 7, 2008 at 7:26 PM, hackbod [EMAIL PROTECTED] wrote: On a phone, I would argue there is pretty much no such thing as a long- lived application. The use of a handheld device is just fundamentally different than a desktop. Even the browser, though you may sometimes spend a lot of time in it, very often you are quickly popping in and out of it. Add in all of the interruptions (SMS, e-mail, chats, phone calls, etc) and the fact that with such a small screen you can only see one app at a time and with such few resources you can only actually have a few apps running in the background at a time... and startup time is pretty important. Plus, keep in mind that flipping open the keyboard means destroying the current activity and starting a new instance of it. As such, you really really don't want to do slow things in Activity.onCreate() or anything it depends on, and would very much be best off avoiding serialization there. You can somewhat mitigate slow startup times here by caching data in your process, using the Activity APIs to transfer state across instances, etc... but best is to just design your app up-front to have a fast startup time, benefiting many important interactions the user has with it. On Oct 7, 5:11 pm, Josh Roesslein [EMAIL PROTECTED] wrote: For a short lived application startup time would be important. But for a long lived application that isn't restarted often it isn't as important. I never liked serialization anyways. There is better and faster ways to persist your application's state to disk. On Tue, Oct 7, 2008 at 6:54 PM, hackbod [EMAIL PROTECTED] wrote: Startup is actually one of the most performance critical parts of an application, since it directly impacts how quickly the user can move to your application from somewhere else, and if that takes a noticeable amount of time (you really want to keep it 1 second) then they are much less likely to use your app. On Oct 7, 3:33 pm, Josh Roesslein [EMAIL PROTECTED] wrote: Yeah I'm not sure how the performance of serialization is on the Dalvik VM. If you are just using serialization during startup/shutdown speed shouldn't matter too much. But if you are loading/unloading objects a lot during the runtime of the application, it might be a bit sluggish. On Tue, Oct 7, 2008 at 5:17 PM, hackbod [EMAIL PROTECTED] wrote: It does support it, but I would generally recommend against it because Java serialization is slow. It's hard to address the original question because there are basically no details. On Oct 7, 2:34 pm, Josh Roesslein [EMAIL PROTECTED] wrote: I believe Android's Java VM fully supports Java Serialization. Trying Googling for java serialization and you should find plenty of tutorials to get you started. On Tue, Oct 7, 2008 at 9:57 AM, Nemat [EMAIL PROTECTED] wrote: Hi, Can anyone tell me about object serialization in Android?? Thanks in Advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com 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 -~--~~~~--~~--~--~---
[android-developers] Re: Object serialization
Parcelable is much much more efficient than Serializable, but you should NOT use it for storing data to persistent storage as described in the Parcel doc http://code.google.com/android/reference/android/os/Parcel.html Of course how much depends entirely on the objects involved, but a 100x difference wouldn't be unexpected. On Oct 8, 3:18 am, Guillaume Perrot [EMAIL PROTECTED] wrote: When passing objects in a Bundle, is a Parcelable more efficient than a Serializable ? How much ? On Oct 8, 2:32 am, Josh Roesslein [EMAIL PROTECTED] wrote: It might be okay to use serialization in services since they would normally run for a long period. Probably the only thing on the Android that would be long lived. On Tue, Oct 7, 2008 at 7:26 PM, hackbod [EMAIL PROTECTED] wrote: On a phone, I would argue there is pretty much no such thing as a long- lived application. The use of a handheld device is just fundamentally different than a desktop. Even the browser, though you may sometimes spend a lot of time in it, very often you are quickly popping in and out of it. Add in all of the interruptions (SMS, e-mail, chats, phone calls, etc) and the fact that with such a small screen you can only see one app at a time and with such few resources you can only actually have a few apps running in the background at a time... and startup time is pretty important. Plus, keep in mind that flipping open the keyboard means destroying the current activity and starting a new instance of it. As such, you really really don't want to do slow things in Activity.onCreate() or anything it depends on, and would very much be best off avoiding serialization there. You can somewhat mitigate slow startup times here by caching data in your process, using the Activity APIs to transfer state across instances, etc... but best is to just design your app up-front to have a fast startup time, benefiting many important interactions the user has with it. On Oct 7, 5:11 pm, Josh Roesslein [EMAIL PROTECTED] wrote: For a short lived application startup time would be important. But for a long lived application that isn't restarted often it isn't as important. I never liked serialization anyways. There is better and faster ways to persist your application's state to disk. On Tue, Oct 7, 2008 at 6:54 PM, hackbod [EMAIL PROTECTED] wrote: Startup is actually one of the most performance critical parts of an application, since it directly impacts how quickly the user can move to your application from somewhere else, and if that takes a noticeable amount of time (you really want to keep it 1 second) then they are much less likely to use your app. On Oct 7, 3:33 pm, Josh Roesslein [EMAIL PROTECTED] wrote: Yeah I'm not sure how the performance of serialization is on the Dalvik VM. If you are just using serialization during startup/shutdown speed shouldn't matter too much. But if you are loading/unloading objects a lot during the runtime of the application, it might be a bit sluggish. On Tue, Oct 7, 2008 at 5:17 PM, hackbod [EMAIL PROTECTED] wrote: It does support it, but I would generally recommend against it because Java serialization is slow. It's hard to address the original question because there are basically no details. On Oct 7, 2:34 pm, Josh Roesslein [EMAIL PROTECTED] wrote: I believe Android's Java VM fully supports Java Serialization. Trying Googling for java serialization and you should find plenty of tutorials to get you started. On Tue, Oct 7, 2008 at 9:57 AM, Nemat [EMAIL PROTECTED] wrote: Hi, Can anyone tell me about object serialization in Android?? Thanks in Advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com 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 -~--~~~~--~~--~--~---
[android-developers] Re: Object serialization
It does support it, but I would generally recommend against it because Java serialization is slow. It's hard to address the original question because there are basically no details. On Oct 7, 2:34 pm, Josh Roesslein [EMAIL PROTECTED] wrote: I believe Android's Java VM fully supports Java Serialization. Trying Googling for java serialization and you should find plenty of tutorials to get you started. On Tue, Oct 7, 2008 at 9:57 AM, Nemat [EMAIL PROTECTED] wrote: Hi, Can anyone tell me about object serialization in Android?? Thanks in Advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com 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 -~--~~~~--~~--~--~---
[android-developers] Re: Object serialization
On a phone, I would argue there is pretty much no such thing as a long- lived application. The use of a handheld device is just fundamentally different than a desktop. Even the browser, though you may sometimes spend a lot of time in it, very often you are quickly popping in and out of it. Add in all of the interruptions (SMS, e-mail, chats, phone calls, etc) and the fact that with such a small screen you can only see one app at a time and with such few resources you can only actually have a few apps running in the background at a time... and startup time is pretty important. Plus, keep in mind that flipping open the keyboard means destroying the current activity and starting a new instance of it. As such, you really really don't want to do slow things in Activity.onCreate() or anything it depends on, and would very much be best off avoiding serialization there. You can somewhat mitigate slow startup times here by caching data in your process, using the Activity APIs to transfer state across instances, etc... but best is to just design your app up-front to have a fast startup time, benefiting many important interactions the user has with it. On Oct 7, 5:11 pm, Josh Roesslein [EMAIL PROTECTED] wrote: For a short lived application startup time would be important. But for a long lived application that isn't restarted often it isn't as important. I never liked serialization anyways. There is better and faster ways to persist your application's state to disk. On Tue, Oct 7, 2008 at 6:54 PM, hackbod [EMAIL PROTECTED] wrote: Startup is actually one of the most performance critical parts of an application, since it directly impacts how quickly the user can move to your application from somewhere else, and if that takes a noticeable amount of time (you really want to keep it 1 second) then they are much less likely to use your app. On Oct 7, 3:33 pm, Josh Roesslein [EMAIL PROTECTED] wrote: Yeah I'm not sure how the performance of serialization is on the Dalvik VM. If you are just using serialization during startup/shutdown speed shouldn't matter too much. But if you are loading/unloading objects a lot during the runtime of the application, it might be a bit sluggish. On Tue, Oct 7, 2008 at 5:17 PM, hackbod [EMAIL PROTECTED] wrote: It does support it, but I would generally recommend against it because Java serialization is slow. It's hard to address the original question because there are basically no details. On Oct 7, 2:34 pm, Josh Roesslein [EMAIL PROTECTED] wrote: I believe Android's Java VM fully supports Java Serialization. Trying Googling for java serialization and you should find plenty of tutorials to get you started. On Tue, Oct 7, 2008 at 9:57 AM, Nemat [EMAIL PROTECTED] wrote: Hi, Can anyone tell me about object serialization in Android?? Thanks in Advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com 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 -~--~~~~--~~--~--~---
[android-developers] Re: Object serialization
It might be okay to use serialization in services since they would normally run for a long period. Probably the only thing on the Android that would be long lived. On Tue, Oct 7, 2008 at 7:26 PM, hackbod [EMAIL PROTECTED] wrote: On a phone, I would argue there is pretty much no such thing as a long- lived application. The use of a handheld device is just fundamentally different than a desktop. Even the browser, though you may sometimes spend a lot of time in it, very often you are quickly popping in and out of it. Add in all of the interruptions (SMS, e-mail, chats, phone calls, etc) and the fact that with such a small screen you can only see one app at a time and with such few resources you can only actually have a few apps running in the background at a time... and startup time is pretty important. Plus, keep in mind that flipping open the keyboard means destroying the current activity and starting a new instance of it. As such, you really really don't want to do slow things in Activity.onCreate() or anything it depends on, and would very much be best off avoiding serialization there. You can somewhat mitigate slow startup times here by caching data in your process, using the Activity APIs to transfer state across instances, etc... but best is to just design your app up-front to have a fast startup time, benefiting many important interactions the user has with it. On Oct 7, 5:11 pm, Josh Roesslein [EMAIL PROTECTED] wrote: For a short lived application startup time would be important. But for a long lived application that isn't restarted often it isn't as important. I never liked serialization anyways. There is better and faster ways to persist your application's state to disk. On Tue, Oct 7, 2008 at 6:54 PM, hackbod [EMAIL PROTECTED] wrote: Startup is actually one of the most performance critical parts of an application, since it directly impacts how quickly the user can move to your application from somewhere else, and if that takes a noticeable amount of time (you really want to keep it 1 second) then they are much less likely to use your app. On Oct 7, 3:33 pm, Josh Roesslein [EMAIL PROTECTED] wrote: Yeah I'm not sure how the performance of serialization is on the Dalvik VM. If you are just using serialization during startup/shutdown speed shouldn't matter too much. But if you are loading/unloading objects a lot during the runtime of the application, it might be a bit sluggish. On Tue, Oct 7, 2008 at 5:17 PM, hackbod [EMAIL PROTECTED] wrote: It does support it, but I would generally recommend against it because Java serialization is slow. It's hard to address the original question because there are basically no details. On Oct 7, 2:34 pm, Josh Roesslein [EMAIL PROTECTED] wrote: I believe Android's Java VM fully supports Java Serialization. Trying Googling for java serialization and you should find plenty of tutorials to get you started. On Tue, Oct 7, 2008 at 9:57 AM, Nemat [EMAIL PROTECTED] wrote: Hi, Can anyone tell me about object serialization in Android?? Thanks in Advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com 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 -~--~~~~--~~--~--~---