Hi everyone,
I have a really big problem and do not know how to solve it.
I have a tab filled with a custom ListView and I am trying to update
the ListView within an AsyncTask.
The code below happends in the onTabChanged method:
progress = ProgressDialog.show(FrankstahlActivity.this,
"Loading...Pleas Wait", "", false, false);
new AsyncTask<Object, Object, Object>()
{
@Override
protected Object doInBackground(Object...
params)
{
segments.removeAllElements();
request.doRequestSegments();
return null;
}
@Override
protected void onPostExecute(Object result)
{
super.onPostExecute(result);
segmentAdapterS.notifyDataSetChanged();
segment.setAdapter(segmentAdapterS);
progress.dismiss();
}
}.execute();
On the Emulator this codes works fine, but when I am trying on a
device (Galaxy S2, Galaxy Note) it crashes after the 5. time changing
the tab. I get an IllegalStateException: Adapter changed but ListView
has not been informed: therefore I tried using
segmentAdapterS.notifyDataSetChanged(); but this also did not solve
the problem. I have already tried this with a Thread and a Handler but
this did not work either.
What I do not understand is how this code can work without crashing on
the emulator but on the device it crashes after the 5. time calling
onTabChanged.
--
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