Quantcast
Channel: PipisCrew Official Homepage
Viewing all articles
Browse latest Browse all 11347

[android] Why do items disappear when I scroll the listView?

$
0
0

source – http://stackoverflow.com/a/6118581/1320686

It’s because you’re hiding some of your views sometimes, and you never show them again. Remember that views are recycled, so, unless you show the views the next time you return one, they will never be visible again.

//source - http://stackoverflow.com/a/6118581/1320686
//author - dmon
        if (!(datapark.get(position).bio.equals(""))){          
          holder.bio.setText(datapark.get(position).bio);
        }else{
          holder.bio.setVisibility(View.GONE);
        }

//instead try:

        if (!(datapark.get(position).bio.equals(""))){ 
          holder.bio.setVisibility(View.VISIBLE);         
          holder.bio.setText(datapark.get(position).bio);
        }else{
          holder.bio.setVisibility(View.GONE);
        }

Viewing all articles
Browse latest Browse all 11347

Latest Images

Trending Articles



Latest Images