how to hide a textview in SimpleAdapter

786 picture 786 · Jan 7, 2013 · Viewed 11k times · Source

am using a simple adapter to show set of strings in different text fields in a listview... i want when i click a particular content in that listview, some textview should be invisible.. how to do that...

my code is

String[] from = new String[] {"ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN"};

int[] to = new int[] { R.id.textView_1, R.id.textView_2, R.id.textView_3, R.id.textView_4, R.id.textView_5, R.id.textView_6, R.id.textView_7};


Adapter adapter = new SimpleAdapter(this, Maps, R.layout.search, from, to);
ListView lvSearch = (ListView) findViewById(R.id.listView_SearchResult);
lvSearchResult.setAdapter(adapter);

here on click

R.id.textView_5, R.id.textView_6, R.id.textView_7

should be invisible

Answer

Marcos Placona picture Marcos Placona · Jan 7, 2013

Not sure what exactly you're looking for here, but if what you're trying to do is simply hide the TextView, you could do the following:

TextView txtView = (TextView)findViewById(R.id.textView_6);
txtView.setVisibility(View.GONE)

We can try and help you further if you provide us with a bit more information.