Faced the following problem:

I use ListActivity to display the list, when I click on an element, another activity opens with the characteristics of the element, but when you press the back button and go to the main activity where there should be a list, it does not exist. Those. the array from which the list is built is present; everything is fine with it, but the list is not displayed.

In the onResume method the following:

 // Initializes list view adapter. mLeDeviceListAdapter = new LeDeviceListAdapter(); setListAdapter(mLeDeviceListAdapter); scanLeDevice(true); 

In the onPause method:

 mLeDeviceListAdapter.clear(); 

The rest of the code did not find where the list could be affected.

Where can there be a problem, and why the list may not be displayed?

thank

Closed due to the fact that off-topic participants pavlofff , PashaPash , Yura Ivanov , Nick Volynkin , Saidolim 5 Sep '15 at 8:32 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - pavlofff, PashaPash, Yura Ivanov, Nick Volynkin, Saidolim
If the question can be reformulated according to the rules set out in the certificate , edit it .

2 answers 2

The problem is solved: in the example, the .clear() method is called not where it is necessary for the array from which data is taken.

    The most banal that can be - is not caused adapter.notifyDataSetChanged() in onResume

    • No, everything is called - Viktor