How can I solve this ListView error?
<p>I am displaying images and text to a listview using a custom adapter, when I run the activity for the first time it displays fine, but when I navigate to another activity and to change a value, when I come back to my listview activity it crashes. and it gives me the following error in Log - </p>

<pre><code>(07-03 08:53:15.456: E/AndroidRuntime(574): 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 stevey.sadc.system101.MobileArrayAdapter)])
</code></pre>

<p>Here is my code:</p>

<pre><code>public class System101Activity extends ListActivity implements OnClickListener {
    public static final String S101 = null;
    private Button btnLogout,btnSignin,btnRegister;
    private TextView txtSharedName;
    public static final ArrayList&lt;String&gt; BookImages = new ArrayList&lt;String&gt;();
    public static final ArrayList&lt;String&gt; BookNames = new ArrayList&lt;String&gt;();
    public static boolean LogedIn = true;
    final Context context = this;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.storemain);
        this.btnLogout = (Button) findViewById(R.id.btnSignout);
        this.btnRegister = (Button) findViewById(R.id.btnSignUp);
        this.btnSignin = (Button) findViewById(R.id.btnSignIn);
        this.btnRegister.setOnClickListener(this);
        this.btnSignin.setOnClickListener(this);
        this.btnLogout.setOnClickListener(this);
        //txtSharedName = (TextView) findViewById(R.id.textviewLogName);
        ///////////////////////////New List//////////////////////////////////////////
        /*if(LogedIn){
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
        String sharedUsername = settings .getString("Sharedusername","null");
        txtSharedName.setText(sharedUsername);
        }else{
            this.btnLogout.setClickable(false);
        }*/
       Log.d("Logged IN", " "+LogedIn); 
        JSONObject json = JSONfunctions.getJSONfromURL("http://10.0.2.2/php/prrrrrrrrr.php");
           // http://api.geonames.org/earthquakesJSON?north=44.1&amp;south=-9.9&amp;east=-22.4&amp;west=55.2&amp;username=demo  
          BookNames.clear();
          BookImages.clear();
        try{

                JSONArray  earthquakes = json.getJSONArray("books");

                for(int i=0;i&lt;earthquakes.length();i++){                        

                    JSONObject e = earthquakes.getJSONObject(i);

                    String BookName = e.getString("bookname");
                    BookNames.add(BookName);
                    String BookImg = e.getString("imageurl");
                    BookImages.add(BookImg);
                }       
            }catch(JSONException e){
                 Log.e("log_tag", "Error parsing data "+e.toString());
            }   

            setListAdapter(new MobileArrayAdapter(this, BookNames,BookImages));

    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {

        //get selected items
        String selectedValue = (String) getListAdapter().getItem(position);
        Toast.makeText(this, selectedValue, Toast.LENGTH_SHORT).show();
        Intent moreDetailsIntent = new Intent(System101Activity.this,MoreBookDetails.class);

        Bundle dataBundle = new Bundle();
        dataBundle.putString("SelectedBook", selectedValue);
        moreDetailsIntent.putExtras(dataBundle);
        startActivity(moreDetailsIntent);
    }

    @Override
    public void onClick(View v) {
        switch(v.getId()){
        case R.id.btnSignUp:
            Intent signupIntent = new Intent(this,RegisterActivity.class);
            startActivity(signupIntent);
            break;
        case R.id.btnSignIn:
            Intent signinIntent = new Intent(this,SignInActivity.class);
            startActivity(signinIntent);
            break;
        case R.id.btnSignout:
///////////////////////////// Creating Alert Dialog/////////////////////////
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
context);

//set title
alertDialogBuilder.setTitle("LogOut");

//set dialog message
alertDialogBuilder
.setMessage("Are You Sure!")
.setCancelable(false)
.setPositiveButton("Yes",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
//LogedIn = false;

    LogedIn = false;
Intent tabIntent = new Intent(System101Activity.this,MyTabs.class);
startActivity(tabIntent);
//Sign.this.finish();
}
})
.setNegativeButton("No",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});

// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();

// show it
alertDialog.show();
////////////////////////////////////////////////////////////////////////////
        }
    }   

}
</code></pre>

<p>Here is My Adapter.</p>

<pre><code>public class MobileArrayAdapter extends ArrayAdapter&lt;String&gt; {
    private final Context context;
    private final String[] myBookNamelist = null;
    private ArrayList&lt;String&gt; MyBooks = new ArrayList&lt;String&gt;();
    private ArrayList&lt;String&gt; myBookImageurl = new ArrayList&lt;String&gt;();
     //ArrayList&lt;HashMap&lt;String, String&gt;&gt; myBookNamelist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
     //ArrayList&lt;HashMap&lt;String, String&gt;&gt; myBookImageurl = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();

    public MobileArrayAdapter(Context context,ArrayList&lt;String&gt; Bname,ArrayList&lt;String&gt; BUrl) {
        super(context, R.layout.mylist, Bname);
        this.context = context;
        this.MyBooks = Bname;
        this.myBookImageurl = BUrl;
    }


    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View rowView = inflater.inflate(R.layout.mylist, parent, false);
        TextView textView = (TextView) rowView.findViewById(R.id.label);
        ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);
        textView.setText(MyBooks.get(position));
        Bitmap bitmap = null;
        // Change icon based on name
        JSONObject json = JSONfunctions.getJSONfromURL("http://10.0.2.2/php/prrrrrrrrr.php");
           // http://api.geonames.org/earthquakesJSON?north=44.1&amp;south=-9.9&amp;east=-22.4&amp;west=55.2&amp;username=demo  
            try{

                JSONArray  earthquakes = json.getJSONArray("books");

                //for(position=0;position&lt;earthquakes.length();position++){
                    JSONObject e = earthquakes.getJSONObject(position);
                    String BB = e.getString("bookname");
                    MyBooks.add(BB);

                    String UU = e.getString("imageurl");
                    myBookImageurl.add(UU);

                //}

            }catch(JSONException e){
                 Log.e("log_tag", "Error parsing data "+e.toString());
            }


            String s = MyBooks.get(position);
            String i = myBookImageurl.get(position);

            System.out.println(s);
            System.out.println(i);


            try {
                bitmap = BitmapFactory.decodeStream((InputStream)new URL(i).getContent());
                imageView.setImageBitmap(bitmap);
            } catch (MalformedURLException err) {
                // TODO Auto-generated catch block
                err.printStackTrace();
            } catch (IOException err) {
                // TODO Auto-generated catch block
                err.printStackTrace();
            }


            System.out.println("Bitmap image: "+position+"="+bitmap);


        return rowView;
    }
}
</code></pre>
