Cannot retrieve all saved objects and show in listView
<p>Hi in my application I am saving string information entered by the user.  then serializing  those string for retrival later.  When I go to open the file to where they are saved I always only get the last string that was entered.    Can you see where i am going wrong? </p>

<p>This is the retrival code</p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.lightlist);


    adapter = new ArrayAdapter&lt;String&gt;(LightList.this, android.R.layout.simple_list_item_1, lightNames);

    refreshBut = (Button)findViewById(R.id.button1);

             try {
                 File file = getCacheDir();
                fis = new FileInputStream(new File(file, LightSetup.FILENAME ));

                ois = new ObjectInputStream(fis);
                             String a;          
                            while((a = (String)ois.readObject()) != null){

                        adapter.add(a);

                        setListAdapter(adapter);
                }

                  ois.close();
            } catch (FileNotFoundException e) {e.printStackTrace();} catch (StreamCorruptedException e){e.printStackTrace();
            } catch (IOException e) {e.printStackTrace();} catch (ClassNotFoundException e) {e.printStackTrace();}
}//end onCreate
</code></pre>

<p>And this is the serializing code</p>

<p>public void onClick(View arg0) {</p>

<pre><code>    String stringData = data.getText().toString();      
        try {

        File file = getCacheDir(); 
        fos = new FileOutputStream(new File(file,FILENAME ));
        os = new ObjectOutputStream(fos);
        os.writeObject(stringData);
        fos.close();
        os.close();

    } catch (IOException e) {e.printStackTrace();}

    Intent i = new Intent("com.Sonny.HCIProject.CreateConfirm");
    startActivity(i);
    finish();

}//end onClick
</code></pre>
