I am creating a ListView where I want to insert images and text (both align horizontal).
The code I have written to create ListView:
private ListView lv1;
private String lv_arr[]={"Android","iPhone","BlackBerry","AndroidPeople","Android","iPhone","BlackBerry","AndroidPeople","Android","iPhone","BlackBerry","AndroidPeople"};
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.contact_activity);
lv1=(ListView)findViewById(R.id.ListView01);
lv1.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lv_arr));
lv1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
/*Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
Toast.LENGTH_SHORT).show();*/
String selecteditem = lv_arr[position];
Intent myIntent = new Intent(view.getContext(), ContactInfo.class);
myIntent.putExtra("item", selecteditem);
startActivity(myIntent);
}
});
}
Here in my case I insert only string but what I want is to insert image and string together in the list. Please suggest me how I can do it.
http://appfulcrum.com/?p=311
http://android-codes-examples.blogspot.com/2011/03/multiple-listview-and-custom-listview.html
http://www.anddev.org/view-layout-resource-problems-f27/dividers-for-imageview-and-textviews-in-expandable-listview-t52970.html
http://androidgenuine.com/?tag=text-and-image-on-a-listview-android
http://devblogs.net/2011/01/04/multicolumn-listview-with-image-icon/
http://www.curious-creature.org/2009/02/22/android-layout-tricks-1/
http://w2davids.wordpress.com/android-listview-with-iconsimages-and-sharks-with-lasers/