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(16908298, class android.widget.ListView) with Adapter(class android.widget.SimpleAdapter)] "
Please call notifyDataSetChanged()
and yourListView.requestLayout()
in the UI thread after adding items.The problem is that your collection that bound to Adapter is changed in the Background thread. Hence the solution is moving it to UI thread(as I stated above) or simply wrapping it with runOnUiThread()
.
runOnUiThread(new Runnable() {
public void run() {
your_collection.add(item);
your_adapter.notifyDataSetChanged();
yourListView.requestLayout();
}
});
To call another fragment the current:
SecondFragment secFrag = new SecondFragment();
FragmentTransaction fragTransaction = getFragmentManager().beginTransaction();
fragTransaction.replace(R.id.frame_fragment,secFrag );
fragTransaction.addToBackStack(null);
fragTransaction.commit();
EDIT:
To Display Detail fragment full Screen, please make following changes:
In your scrollView Replace
android:layout_height="wrap_content"
withandroid:layout_height="fill_parent"
In your TableLayout Replace
android:layout_height="wrap_content"
withandroid:layout_height="fill_parent"