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
-~----------~----~----~----~------~----~------~--~---

Reply via email to