im trying to create a ListView filled with items fetched from an API, and depending on a variable, I want to show/hide an TextView in my ListView item layout for that row.
My ListView item layout contains 3 TextViews. One is hidden on default using android:visibilty:”GONE”.
I am using a this for my ListAdapter:
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
Attach to:
ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.main,
new String[] { "title", "info","comments", "score" },
new int[] { R.id.item_title, R.id.item_subtitle, R.id.post_comments, R.id.post_score });
setListAdapter(adapter);
final ListView lv = getListView();
So my question is, how can I iterate the whole list to check if “VariableA” == “something” then show the hidden TextView within that single item?
Or is there a way to dynamically Insert a TextView in that a single ListView item?
Thanks!
You should create Custom Adapter For Listview and write Some Logic in