Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying bitmap image in imageview by simple adapter
    primarykey
    data
    text
    <p>I am getting image from an url. I am using imageview in listview. I want to add the list of bitmap images into the each row of the list item. I used SimpleAdapter but the imageview shows blank.My code is below !!</p> <pre><code> ArrayList&lt;HashMap&lt;String, Bitmap&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, Bitmap&gt;&gt;(); Bundle bundle = this.getIntent().getExtras(); get = bundle.getString("name"); try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.propertyhookup.com/mobile/propertylist.php"); nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1); nameValuePairs.add(new BasicNameValuePair("zipcode", get.trim())); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); }catch(Exception e){ Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } //convert response to string try{ BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result=sb.toString(); }catch(Exception e){ Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } if(result.length()&lt;= 7){ Toast.makeText(getApplicationContext(), "No properties for this zipcode or check your zipcode ", Toast.LENGTH_LONG).show(); //text.setText("No properties for this zipcode or check your zipcode"); } else{ try{ jArray = new JSONObject(result); }catch(JSONException e){ Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } //JSONObject json = JSONfunctions.getJSONfromURL("http://192.168.1.111/propertyhookup.com/mobile/propertylist.php"); try{ JSONArray earthquakes = jArray.getJSONArray("earthquakes"); for(int i=0;i&lt;10;i++){ map = new HashMap&lt;String, Bitmap&gt;(); //HashMap&lt;String, Drawable&gt; map1 = new HashMap&lt;String, Drawable&gt;(); JSONObject e = earthquakes.getJSONObject(i); if(e.getString("property_type").contains("1")) { proptype ="Single Family Home"; }else if(e.getString("property_type").contains("2")) { proptype="Condo"; }else if(e.getString("property_type").contains("3")) { proptype="Townhouse"; } if(e.getString("estimated_price").contains("0")) { estimate = "Not Enough Market Value"; //estimat = (TextView) findViewById(R.id.estimat); //estimat.setTextColor(Color.rgb(0, 0, 23)); }else { estimate = "$"+e.getString("estimated_price"); } photo = e.getString("photo1"); drawable = LoadImageFromWebOperations(photo); //text.setImageDrawable(d); try { aURL = new URL(photo); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } URLConnection conn = null; try { conn = aURL.openConnection(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { conn.connect(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } InputStream is = null; try { is = conn.getInputStream(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BufferedInputStream bis = new BufferedInputStream(is,8*1024); Bitmap bm = BitmapFactory.decodeStream(bis); map.put(photos, bm); mylist.add(map); } }catch(JSONException e) { Toast.makeText(getApplicationContext(),e.getMessage(), Toast.LENGTH_LONG).show(); } SimpleAdapter adapter = new SimpleAdapter(this, mylist , R.layout.main4, new String[] { "percent","propertyid", "cityname", "statecode", "propertytype", "footage", "bathroom", "bedroom", "price", "estimated", "photos" }, new int[] { R.id.percent, R.id.property_id, R.id.city_name, R.id.state_code, R.id.prop_type, R.id.foot, R.id.bath, R.id.bed, R.id.list, R.id.estimat, R.id.image}); setListAdapter(adapter); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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