Android : Hiding textview in a listview based on dynamic position

on Tuesday, September 9, 2014


In my listview I have 3 textviews and I want to hide one textview at some positions. The positions at which TextView must hide comes at runtime based on some condition.


If I get the indexes I want to hide, in an array and use this logic,then it hides the TextView only for the last index. please help.



int []x={1,2,4};
for(int i=0;i<x.length;i++){


if(position==x[i]){
holder.time.setVisibility(View.GONE);
}
else{
holder.time.setVisibility(View.VISIBLE);
}
}

0 comments:

Post a Comment