0

How can I make different items in list appear when there is content and not where there is no content? Rather than the app crashing?

"https://i.stack.imgur.com/GZ5uJ.jpg"

For Example, I want to remove something from the listview however dynamically some will have "Artist" and or some will not.

Blackbelt
  • 156,034
  • 29
  • 297
  • 305
shap4th
  • 129
  • 1
  • 4
  • This might be of some help to you: http://stackoverflow.com/a/13634801/3198507. Where he has "Header 1," Header 2," just replace with what you'd rather see. – trag04 Mar 02 '14 at 17:35
  • I want to hide a single item in the listview in some circumstances. Not ListHeaders! – shap4th Mar 02 '14 at 17:52

1 Answers1

0

You'll need a custom adapter (extend ArrayAdapter). Override getItem(), getCount(), and getItemId(). Keep an internal list of integers which represents items to hide. Then, in getItem(int position) check to see if "position" is within that internal list and increment the position value if it is.

trag04
  • 1
  • 2