android - Problems with Serialization -


There are some problems with sorting my items.

Missing, because my app is not like saving .dat.

We show some code:

load .dat file

  Public Zero Dark (Object Output Stream Out) IOException Throws {out.writeObject (lista); Out.writeObject (cadeiras); Out.writeObject (notas); Out.close (); }   

Save the .dat file

  throws the Public Zero Effective (ObjectInputStream in) IOException, ClassNotFoundException {lista = (ArrayList & Lt; string & gt;) in.readObject (); Cadeiras = (ArrayList & lt; string & gt;) in.readObject (); Notas = (ArrayList & lt; string & gt;) in.readObject (); In.close (); }   

When I try to save the file, my app catches the exception FileNotFoundException here:

  case R.id. Gravar: Object OutputStream Out; Try {out = new object overputstream (new file output stream (FICH)); Gravar (outside); Toast. Make Text (getApplicationContext (), "Good!", Toast. LNNGH_LAG). Show (); } Hold (FileNotFoundException E) {// TODO Auto-Generated Catch Block Toast MakeApplicationContext (), "Error 1!", Toast. LNNGGH_LOG). Show (); E.printStackTrace (); } Grip (IOE EXPRESS E) {Toast. MakeApplicationContext (), "Error 2!", Toast.LnnGH_LOG). Show (); E.printStackTrace (); } Back true;   

Fitch is:

  Private Static String Fitch = "gravar.dat";   

What am I missing? For better help, I give my code here.

Thanks in advance!

You pass the whole path instead of the file name on the file only file on the output stream should do.

If doing so does not try it

  New FileOutputStream (new file (Fitch));    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

memcached - Django cache performance -

java : convert string value to int -