Thursday, 15 March 2012

android - Change image of listview item on click -


I'm trying to change the image of a list item on click. I tried to use the scene, but using it, I'm getting many items with changed image, even if I just click on one. I am using a simple cursor adapter and similar to the code given in this question: -

And I do not even want to use custom Adapter. It would be really helpful if someone helps me solve this problem through a simple adapter.

Current code

  @Override protected void onListItemClick (ListView l, View v, Int Status, Long ID) {// Tudo Auto-Generated Method Stub / * imageView = (ImageView) l.getChildAt (status). FindViewById (R.id.PlayPause); ImageView.setImageResource (R.drawable.pause); 1- When you are getting straight into the event "Vision V" As the baby scene  

2- After setting a new background resource, you need to call the invalid () method on the view. Click on List Element (ListView, Vieu V, Int Position, Long ID), at the

  @override protected zero. {ImageView = ((Image view) V) imageView.setImageResource (R.drawable.pause) ; ImageView.invalidate ();   

}

When you use an image cursor adapter to your list, an image view ----: -

Refer this link for this.

No comments:

Post a Comment