android - Problems with serializable java -


I am trying to implement serializable in Java, but I get an excepcion.

This is my serial category: Public category serialization java.io.Serializable {Private Static last long serial VERSIONUID = 1 L; Public double dis1; Public double dis2; Public double error 1; Public double error 2; Public double coaches; Public Double Corpus; Public Double Coorg; }

And when I try to create this square object and convert it to bytes.

  Serialize serial = new Serialize (); Serial.dis1 = dis1; Serial.dis2 = dis2; Serial.error1 = error1; Serial .error2 = error2; Serial.coorx = coorx; Serial = korean; Serial.coorz = Coeur; Byte [] bytes = null; Int length = 0; Try {Bitherean OutputStream BS = New BytereOutStream (); ObjectOutputStream OS = New ObjectOutputStream (BS); Os.writeObject (serial); /// EXCEPCION os.close (); Bytes = B.T.Bitere (); Length = bytes Lamps; } Hold (IOException e) {e.printStackTrace (); }   

What am I doing?

Logcat:

  04-24 09: 15: 29.734: W / System Err (4279): java.io.NotSerializableException: org.gradiant.sistole.locservice Communication 04-24 09: 15: 29.734: W / Systems. Er (4279): java.io.ObjectOutputStream.writeNewObject (at ObjectOutputStream.java): 1364) 04-24 09: 15: 29.734: W / Systems. Er (4279): java.io.ObjectOutputStream.writeObjectInternal at (ObjectOutputStream.java:1671) 04-24 09: 15: 29.734: w / System.err (4279): java.io.ObjectOutputStream.writeObject (ObjectOutputStream.java : 1517) 04-24 09: 15: 29.734: W / Systems. Er (4279): java.io.ObjectOutputStream.writeObject (on ObjectOutputStream.java: 1481) 04-249 9: 15: 29.734: W / Systems. ARR (4279): OutputStream at the Java.O.Object. Lithfield Value (Object overputstream.java: 9) 04-24 09: 15: 29.734: W / Systems. Er (4279): java.io.ObjectOutputStream.defaultWriteObject (ObjectOutputStream.java:368) 04-24 09: 15: 29.734: W / Systems. Er (4279): at java.io.ObjectOutputStream.writeHierarchy (ObjectOutputStream.java:1074) 04-249 9: 15: 29.734: W / Systems. Er (4279): java.io.ObjectOutputStream.writeNewObject (Object overputstream.java404) 04-24 09: 15: 29.734: W / Systems. Er (4279): Java.io.ObjectOutputStream.writeObjectInternal at (ObjectOutputStream.java:1671) 04-24 09: 15: 29.734: W / Systems. Er (4279): java.io.ObjectOutputStream.writeObject (ObjectOutputStream.java.1517) 04 -24-09: 15: 29.734: W / Systems. ARR (4279): at java.io.ObjectOutputStream.writeObject (Object overputstream.jar provider) 04-24 09: 15: 29.734: W / Systems. Er (4279): At org.gradiant.sistole.locservice.Communication.datarequest (Communication.java:447) 04-24 09: 15: 29.734: W / Systems. Er (4279): at org.gradiant.sistole.locservice.UWBmain.process (UWBmain.java:311) 04-24 09: 15: 29.734: W / Systems Er (4279): at org.gradiant.sistole.locservice.UWBmain $ 2.run (UWBmain.javaociety79) 04-24 09:15: 29.734: W / Systems. Er (4279): at java.lang.Thread.run (Thread.Java: 841)   

Thanks

It seems that you try to serialize a square org.gradiant.sistole.locservice.number of communication, is it an object in which you try to serialize ? Serialization should also be done to serialize the object as compared to that object. If you do not need an object then you can make it transient:

  transient communication comm = new communication (...);   

will not be serial compared to this object and if you deserialize the object it will be zero

If you can not implement serializable and If you need it on deserialization then you have to remove a way to rebuild the object on deserialization.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -