Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>the issue about that "sometimes the image doesn't even load" is related to the context so I used this functions to solve that issue </p> <pre><code>public Object fetch(String address) throws MalformedURLException, IOException { URL url = new URL(address); Object content = url.getContent(); return content; } private Drawable ImageOperations(Context ctx, String url) { try { InputStream is = (InputStream) this.fetch(url); Drawable d = Drawable.createFromStream(is, "src"); return d; } catch (MalformedURLException e) { return null; } catch (IOException e) { return null; } } </code></pre> <p>so to fill the screen width with your image you must have a code like this</p> <pre><code> try{ String url = "http://farm1.static.flickr.com/150/399390737_7a3d508730_b.jpg"; Drawable image =ImageOperations(this,url); Image01.setImageDrawable(image); } catch(Exception ex) { ex.printStackTrace(); } Image01.setMinimumWidth(width); Image01.setMinimumHeight(height); Image01.setMaxWidth(width); Image01.setMaxHeight(height); </code></pre> <p>UPDATE:: if you load a big size image obviously you will have to wait more time, and download problems could be caused for UnknowHostException.</p> <p>yes you are right you will save your image locally, the local access is faster than the download.</p> <p>to avoid problems on rotation change set your configChanges="keyboardHidden|orientation" property inside your Manifest.xml</p> <pre><code>&lt;activity android:name=".myActivity" ... android:configChanges="keyboardHidden|orientation" &gt; ... /&gt; </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