Displaying image from server in android
<p>I want to display an image from server. Actaully I need to display a paragraph and along with that an image. I have chosen a list view for this.
At present I am displaying the paragraph but when I am trying to display the image it is not working. Help me regarding this...</p>

<p>My Code:</p>

<pre><code>private class ListAdapter extends ArrayAdapter&lt;UserBO&gt; { 
--
--
--
--  public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
            try {
                if (view == null) {
                    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                    view = vi.inflate(R.layout.list_item, null);
                    // --CloneChangeRequired(list_item)
                }
                final UserBO listItem = mList.get(position); // --CloneChangeRequired
                if (listItem != null) {
--
--
--
--
imageUrl = "http://server.com//folder/"+ array.get(0);
((TextView) view.findViewById(R.id.description))
                            .setText(listItem.getdesc()));

downloadFile(imageUrl);
----
--
}
}
}
}

    void downloadFile(String fileUrl) {
        URL myFileUrl = null;
        try {
            myFileUrl = new URL(fileUrl);
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        try {
            HttpURLConnection conn = (HttpURLConnection) myFileUrl
                    .openConnection();
            conn.setDoInput(true);
            conn.connect();
            int length = conn.getContentLength();
            InputStream is = conn.getInputStream();

            bmImg = BitmapFactory.decodeStream(is);
            imView.setImageBitmap(bmImg);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
</code></pre>
