I have an activity that contains a private Vector<myobject>, thread safe 
version of ArrayList.  The activity adds items to the ArrayList, and in 
onSaveInstanceState() I save the data (see code below).  The problem is 
that it looses items and it seems to have after the GC runs.  So what am I 
missing?


    private static RecentItems _lstRecent;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
     restoreRecents(savedInstanceState);
    }

    @Override
    protected void onSaveInstanceState(Bundle outState){
        super.onSaveInstanceState(outState);
        
        String s=serializeIt(_lstRecent);
        bundle.putString("lstRecent", s);
    }
    
    @Override
    protected void onRestoreInstanceState(Bundle outState){
        super.onSaveInstanceState(outState);
        
        this.restoreRecents(outState);
    }

    private void restoreRecents(Bundle bundle){
     if (bundle!=null){
         String s = bundle.getString("lstRecent");
            _lstRecent=deserializeIt(s);
        }
         
        if (_lstRecent ==null)
            _lstRecent=new RecentItems();//unt

    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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

Reply via email to