Last active
April 25, 2016 15:45
-
-
Save Rexee/ce2fda12fd49feaabf90 to your computer and use it in GitHub Desktop.
SimpleAdapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[] texts = {"sometext 1", "sometext 2", "sometext 3"}; | |
ArrayList<Map<String, Object>> data = new ArrayList<Map<String, Object>>(texts.length); | |
Map<String, Object> m; | |
for (int i = 0; i < texts.length; i++) { | |
m = new HashMap<String, Object>(); | |
m.put("TEXT", texts[i]); | |
data.add(m); | |
} | |
String[] from = {"TEXT"}; | |
int[] to = { android.R.id.text1}; | |
SimpleAdapter sAdapter = new SimpleAdapter(this, data, android.R.layout.simple_list_item_1, from, to); | |
ListView mListView = (ListView) findViewById(R.id.participants); | |
mListView.setAdapter(sAdapter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment