android - Loading Bitmaps Efficiently -


I was going through the developer. To load Android page bitmaps efficiently, and here: they talk about loading a scale-down version of memory, which is clearly very efficient

Now my problem is that given The method requires resources ID, which is when we download images / bitmaps from the Internet (Please correct me if I am wrong here).

So is there any way we can use some variation of the method given for images downloaded from the internet ??

  increases the public class fetch image activity tools OnClickListener {int id ; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); Id = 1; // now declared as steady} {new page geometric (). carry about (); File storage path = environment .getExternalStorage directory (); File imgFile = new file (storage path, "/ image /" + id + ".jpg"); If (imgFile.exists ()) {bitmap myBitmap = BitmapFactory.decodeFile (imgFile .getAbsolutePath ()); }} Class parsed root asyncTask and lt; Zero, zero, zero> {Progress DIOL MDI Log; Prerequest () secure void {mDialog = ProgressDialog.show (fetchImage.this, "", getString (R.string.progress_bar_loading), true); }; @ Override Protected Voice Doine Background ({0} parameter {save (save (id, empty);} (last exception e) {} return tap;} Private zero service (Ent ID, URL Yuri) throws IOException {URL Url; if (uri == faucet) {url = new URL ("http://i.zdnet.com/blogs/3-29-androids.jpg");} and {url = uri;} inputstream input = url .openstream (); {try} FileStoragePath = Environment.getExternalStorage directory (); OutputStream output = New fileOptputTream (new file (storage path, "/ f Try / byte [] + buffer = new byte [20000]; Int bytesread = 0; while ((bytesread = input .reed (buffer, 0, buffer, lamps)). Gt; = 0) {output.write (buffer, 0, bytes read);}} end {output.close ();}} hold (exception e) {e.printStackTrace ();} Finally {input.close ();}} Secure zero (zero result) on pseudoextext {mDialog.dismiss ();};} @ Override Public Wide Onclick Onclick (see V) {// TODO Auto-Generated Method Stub}}    

Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -