I'm using the following code for the dynamic ListView. I need to add some images in fromt of the text in the ListView
ListView listView = (ListView) menu.findViewById(R.id.list);
initListView(this, listView, "", 5, android.R.layout.simple_list_item_1);
public void initListView(Context context, ListView listView, String prefix, int numItems, int layout) {
// By using setAdpater method in listview we an add string array in list.
String[] arr ={"A","B","C","D","E"};
listView.setAdapter(new ArrayAdapter<String>(context, layout, arr));
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
});
}
Please let me know how to add images in my code.
ArrayAdapter. Create aCustomAdapterfor it. Search for tutorial on here