I am developing a android app in which i have to expand the particular image in the grid view on which user clicks.Is there any way to do it.Any help will be appreciated.I have used two approaches but not achieved the same

First: used in getview() method:
if(array[position]!=null)
if(array[position].equals("1")){
imageView.setLayoutParams(new LinearLayout.LayoutParams(80, 80, 1));
}
imageView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
final int posit = gridview.getPositionForView((View)v.getParent());
array[posit]="1";
((BaseAdapter)gridview.getAdapter()).notifyDataSetChanged();
break;
}
return true;
}
});
Second:
imageView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
v.setLayoutParams(new LinearLayout.LayoutParams(80, 80, 1));
((BaseAdapter)gridview.getAdapter()).notifyDataSetChanged();
break;
}
return true;
}
});
But these two methods are not showing the correct result it is expanding the images randomly what should i do. Any idea will be appreciated.
Edit : For that problem, you have to keep track of changed views say for example take a Boolean array, when you change view’s property, keep true for that position in array. When you scroll view’s, whichever array positions are true, for them only you set enlarge property else set default property like below.