Hi,
I'm using a ListActivity, with onConfigurationChanged. I'm doing this
because I don't want onCreate to be called so i don't have to reload
data in the list view every time I change orientation.
I've found that when I call setListAdapter in the onCreate method of
my ListActivity , after a Number of orientation changes I get an out
of memory error. If I don't set the ListAdapter I don't see the out of
memory error.
Just wondering if anyone else has seen this and knows of a way to
solve it?
Thanks, Example of the Code is Below:
public class MyActivity extends ListActivity {
private MyAdapter myAdapter;
private ArrayList<String> data = new ArrayList<String>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dictionary);
this.myAdapter= new MyAdapter(this, R.layout.mylayout, data);
setListAdapter(this.myAdapter); //<--- If I remove this
line I do not see the memory leak on rotation of the screen
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(R.layout.main); // <------ Needed to load
portrait/landscape layout
}
}
--
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