I have List in a social networking app where i need to increase number of likes when user hits like button.
The onclicklistener inside adapter and I am reloading the whole list which makes the list go to top when reloading and i have to make it stay at same post so that user keeps seeing same post not the top of list my adapter code is like this:
public class PaListAdapter extends ArrayAdapter<GroupPostValues> {
public PaListAdapter(Context context, int resource) {
super(context, resource);
}
public View getView(int position, View convertView, ViewGroup parent) {
ImageView likeBtn = (ImageView) convertView
.findViewById(R.id.likeImage);
likeBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// some asyncTask to call web servic that will increase likes
}
});
return convertView;
}
}
0 comments:
Post a Comment