---
title: "How to set image in listview android?"  
description: "How to set image in listview android?"  
author: "Allen Scott"  
published: 2014-11-15  
updated: 2014-11-15  
canonical: https://www.mindstick.com/forum/12593/how-to-set-image-in-listview-android  
category: "android"  
tags: ["android listview", "image view"]  
reading_time: 1 minute  

---

# How to set image in listview android?

set [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) in [listview](https://www.mindstick.com/articles/12744/listview-in-android) [android](https://www.mindstick.com/articles/13046/10-reasons-why-i-prefer-android-vs-iphone-ios)

## Replies

### Reply by Anurag Sharma

```
public class MainActivity extends Activity {  ListView list;  String[] webString =
{    "Google Plus",      "Twitter",      "Windows",      "Bing",      "Itunes",      "Wordpress",    "Drupal"  } ;Integer[] imageId = {     
R.drawable.google,     
R.drawable.twitter,     
R.drawable.windows,      R.drawable.bing,      R.drawable.itunes,     
R.drawable.wordpress,     
R.drawable.drupal  };@Override 
protected void onCreate(Bundle savedInstanceState) {   
super.onCreate(savedInstanceState);   
setContentView(R.layout.activity_main);   
CustomList adapter = new    
CustomList(MainActivity.this, webString, imageId);   
list=(ListView)findViewById(R.id.listview);       
list.setAdapter(adapter);       
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {                @Override                public void
onItemClick(AdapterView<?> parent, View view,                                        int
position, long id) {                   
Toast.makeText(MainActivity.this, "You Clicked at " +webString[+
position], Toast.LENGTH_SHORT).show();                }           
});  }}
```

\
![How to set image in listview android?](https://www.mindstick.com/mindstickforums/9357dd56-84ef-4d04-be9e-95ab25e09a84/images/0dddc820-f455-494e-bc67-ffceb1d33acc.png)\


---

Original Source: https://www.mindstick.com/forum/12593/how-to-set-image-in-listview-android

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
