heathcliff
heathcliff

Reputation: 1

Android How can I change image on gridview by position?

I have a slide puzzle game.

I want to change image on GridView by position(id).

How could I do that?

Upvotes: 0

Views: 143

Answers (1)

DJhon
DJhon

Reputation: 1518

Try this

     gridView.setOnItemClickListener(new OnItemClickListener()
 {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3)
{
    // You can get position of item or imageView and again you can set new image  
   //  by setBackGround() by getting this position

}
 });

Upvotes: 3

Related Questions