Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to parse image from URL
    primarykey
    data
    text
    <p>Ive been getting this error:</p> <blockquote> <p>10-16 21:56:30.502: INFO/System.out(361): resolveUri failed on bad bitmap uri: android.graphics.drawable.BitmapDrawable@44f0c0c8</p> </blockquote> <p>While trying to run this code</p> <pre><code>public class deals extends Activity{ private ArrayList&lt;HashMap&lt;String, Drawable&gt;&gt; myBooks; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.deal); myBooks = new ArrayList&lt;HashMap&lt;String,Drawable&gt;&gt;(); HashMap&lt;String, Drawable&gt; hm; ListView myListView = (ListView) findViewById(R.id.listView1); Environment.getExternalStorageDirectory().getAbsolutePath(); Drawable drawable3 = LoadImageFromWebOperations("http://www.bitterwallet.com/wp-content/uploads/2010/04/Tesco-Logo-Colour.jpg"); hm = new HashMap&lt;String, Drawable&gt;(); hm.put("Company", null); hm.put("Offer", null); hm.put("IMG", LoadImageFromWebOperations("http://2.bp.blogspot.com/_mCJwxGhlcQQ/TJxEHIOTpnI/AAAAAAAACqA/D11qqbNam80/s1600/TESCO+logo.jpg")); myBooks.add(hm); SimpleAdapter adapter = new SimpleAdapter(this, myBooks, R.layout.listview, new String[]{"company","offer","IMG"}, new int[]{R.id.text1, R.id.text2, R.id.img}); myListView.setAdapter(adapter); try { JSONArray jsonArray = new JSONArray(readTwitterFeed()); int length = jsonArray.length(); List&lt;String&gt; listContents = new ArrayList&lt;String&gt;(length); for (int i = 0; i &lt; length; i++) { // listContents.add(jsonArray.getString(i)); System.out.println(jsonArray.getString(i)); } // myListView.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, listContents)); } catch (Exception e) { e.printStackTrace(); } } public String readTwitterFeed() { StringBuilder builder = new StringBuilder(); System.out.println("here"); HttpClient client = new DefaultHttpClient(); //HttpGet httpGet = new HttpGet( // "http://www.hotels-in-london-hotels.com/mytrolly/service.php?request={\"mode\":\"category\"}"); String url = ""; try { //url = "http://hotels-in-london-hotels.com/mytrolly/service.php?request={\"mode\":\"search\",\"category\":\"2\",\"seller\":\"0\",\"page\":\"1\"}"; url = "http://www.hotels-in-london-hotels.com/mytrolly/serviceSeller.php"; System.out.println(url); String encodedurl = URLEncoder.encode(url,"UTF-8"); Log.d("TEST", encodedurl); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } HttpGet httpGet = new HttpGet(url); System.out.println("here"); try { HttpResponse response = client.execute(httpGet); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(content)); String line; while ((line = reader.readLine()) != null) { builder.append(line); } } else { //Log.e(ParseJSON.class.toString(), "Failed to download file"); } } catch (ClientProtocolException e) { e.printStackTrace(); System.out.println("here is the error" + e.toString()); } catch (IOException e) { e.printStackTrace(); System.out.println("here is the error" + e.toString()); } return builder.toString(); } private Drawable LoadImageFromWebOperations(String url) { try { InputStream is = (InputStream) new URL(url).getContent(); Drawable d = Drawable.createFromStream(is, "src name"); return d; }catch (Exception e) { System.out.println("Exc="+e); return null; } } } </code></pre> <p>I've tried doing something similar to this lad:</p> <p><a href="https://stackoverflow.com/questions/5095676/resolveuri-failed-on-bad-bitmap-uri-when-putting-image-on-listview">&quot;resolveUri failed on bad bitmap uri&quot; when putting image on ListView</a></p> <p>But I got a null pointer exception. Does anyone know how to get around this issue?</p>
    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.
    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