It is necessary by clicking on the item in the ListView to change the Image (mark as viewed record). I use the following code:
lv.setOnItemClickListener(new OnItemClickListener() { for (int i = 0; i <= lv.getCount(); i++) { //.getAdapter().getCount() //.getCount(); if (position == i) { if (dbHandler.getDeliveredShipping(_id) == true) { ((ImageView) view.findViewById(R.id.subscriberVisited_image)).setImageResource(R.drawable.ic_check_all); } else if (dbHandler.getDeliveredShipping(_id) == false) { //http://stackoverflow.com/questions/21908022/change-image-of-imageview-onitemclicklistener-of-listview-in-android ((ImageView) view.findViewById(R.id.subscriberVisited_image)).setImageResource(R.drawable.ic_check); //lv.getChildAt(i).setBackgroundColor(Color.BLUE); } } } }); Clicking on one item picture (daw) changes also changes to the lower standing item (about 7 points to the bottom). Did debug, no hops to lower item. How does this happen?
Adapter:
SimpleAdapter adapter; lv = getListView(); ArrayList<HashMap<String, String>> contactList; contactList = new ArrayList<HashMap<String, String>>(); protected void onPostExecute(Void result) { super.onPostExecute(result); // Dismiss the progress dialog if (pDialog.isShowing()) pDialog.dismiss(); /** * Updating parsed JSON data into ListView // * */ adapter = new SimpleAdapter( MainActivity.this, contactList, R.layout.list_item, new String[]{TAG_ID, TAG_SUBSCRIBER_NAME, TAG_NEWSPAPER_MNEMONIK_NAME, TAG_NUMBER_PUBLICATION, TAG_PHONE1}, new int[]{R.id.idShipping, R.id.subscriberName, R.id.newspaperName, R.id.newspaperPubNumber, R.id.subscriberTelNumber} ); setListAdapter(adapter); lv.setTextFilterEnabled(true); } 