I’m reading different forums for hours but I want to understand what is getting GarbageCollected on onPause.
- I’ve got a ListView with a custom Adapter (ImageView+Textview) and it’s getting filled with an ArrayList
- After onPause is called the view is empty although the ArrayList with Objects is still there.
So, in onResume I try to create a new Adapter to fill the ListView once more.
I also use the Holder pattern and I noticed that View convertView was cleared in onPause.
Could someone tell me why it is not working to set the following in onResume() with arraylist still filled with objects?
adapter = new MyAdapter(this, R.layout.listview_item, arraylist);
myView = (ListView) findViewById(R.id.main_ListView_items);
myView.setAdapter(adapter);
I also tried to store all fields adapter, myView and arraylist in the MyApplication extends Application class but with the same result.
A blank ListView appears after running->onPause->onResume ->running
I think I got it. I had
setContentView(R.layout.main)inonConfigurationChangedone more time, so afteronPauseI had a blankcontentView:)) Sometimes you spend hours of your precious life for such dumb errors..