Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading an Image into Imageview
    text
    copied!<p>I am facing problem while trying to call <em>ImageLoader's DisplayImage function</em>, actually not getting what i need to use <strong>to Display Image</strong>:</p> <pre><code> imgLoader.DisplayImage (....); </code></pre> <p>I am writing an App in which I need to Load an Image into ImageView, but always getting blank in place of Image, please see below image:</p> <p><img src="https://i.stack.imgur.com/EkoOd.png" alt="enter image description here"></p> <p><strong>Note:</strong> I don't know what i need to use, in this line:</p> <pre><code> ImageLoader imgLoader = new ImageLoader(getApplicationContext()); imgLoader.DisplayImage(url, loader, imageView); </code></pre> <p><em>So Please just show me the code, what i need to write to show image in ImageView, according to my code</em></p> <p>I am using Localhost to fetch Image, Please see below code using to get Images-</p> <pre><code>private static final String URL_ALBUMS = "http://10.0.2.2/songs/albums.php"; private static final String TAG_IMAGE = "imagepath"; String image = c.getString(TAG_IMAGE); HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); // adding each child node to HashMap key =&gt; value map.put(TAG_IMAGE, image); protected void onPostExecute(String file_url) { // dismiss the dialog after getting all albums pDialog.dismiss(); // updating UI from Background Thread runOnUiThread(new Runnable() { public void run() { /** * Updating parsed JSON data into ListView * */ ListAdapter adapter = new SimpleAdapter( AlbumsActivity.this, albumsList, R.layout.list_item_albums, new String[] { TAG_ID, TAG_NAME, TAG_IMAGE, TAG_SONGS_COUNT }, new int[] { R.id.album_id, R.id.album_name, R.id.list_image, R.id.songs_count }); // ImageLoader class instance ImageLoader imgLoader = new ImageLoader(getApplicationContext()); // here i don't know how to call DisplayImage function imgLoader.DisplayImage (....); // what to write here // updating listview setListAdapter(adapter); } }); </code></pre> <p><strong>Note-</strong> I have added all <em>required classes</em> in my Project, classes are: </p> <pre><code> ImageLoader.java, FileCache.java, MemoryCache.java &amp; Utils.java </code></pre> <p><em>data.php:-</em></p> <pre><code> 1 =&gt; array( "id" =&gt; 1, "album" =&gt; "127 Hours", "imageurl" =&gt; "images/onetwentyseven.png" ............ </code></pre> <p>Note:- As you can see, i am using <em>local images</em>, those i have <em>stored</em> in <strong>localhost in images</strong> folder.</p> <p><em>JSON:-</em></p> <pre><code>[{"id":1,"name":"127 Hours","imagepath":"images\/onetwentyseven.png","songs_count":2},{"id":2,"name":"Adele 21","imagepath":"images\/adele.png","songs_count":2}] </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload