Hi I'm trying to develop an app that could list all installed app's along with their cache, and I'm doing it, but problem is when ever I tap on list I get Force Close
Here is my code
new AsyncTask<Void, Void, Void>() {
@Override
protected void onPreExecute()
{
pd = ProgressDialog.show(Messages.this, "Loading..","Please Wait", true, false);
}// End of onPreExecute method
@Override
protected Void doInBackground(Void... params)
{
MessageDetails Detail;
Detail = new MessageDetails();
Detail.setIcon(getPackageManager().getApplicationIcon( pStats.packageName ));
Detail.setName(title);
Detail.setSub("Cache Size -> "+(((pStats.cacheSize/1024) > 0)?(pStats.cacheSize/1024):"No Cache"));
details.add(Detail);
return null;
}// End of doInBackground method
@Override
protected void onPostExecute(Void result) {
msgList.setAdapter(new CustomAdapter(details, Messages.this));
pd.dismiss();
}// End of onPostExecute method
}.execute((Void[]) null);
Please help me to solve this riddle, Thanks in advance.
Stack Trace
E/AndroidRuntime(1143): java.lang.IllegalStateException: The content of the adapter has
changed but ListView did not receive a notification.
Make sure the content of your adapter is not modified from a background thread,
but only from the UI thread.
[in ListView(2131230725, class android.widget.ListView)
with Adapter(class com.example.temptocache.CustomAdapter)]