Created
July 24, 2014 04:35
-
-
Save Nasawa/672cf29d95e524b60a61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// show The Image | |
new DownloadImageTask((ImageView) findViewById(R.id.imageView1)) | |
.execute("http://java.sogeti.nl/JavaBlog/wp-content/uploads/2009/04/android_icon_256.png"); | |
} | |
public void onClick(View v) { | |
startActivity(new Intent(this, IndexActivity.class)); | |
finish(); | |
} | |
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> { | |
ImageView bmImage; | |
public DownloadImageTask(ImageView bmImage) { | |
this.bmImage = bmImage; | |
} | |
protected Bitmap doInBackground(String... urls) { | |
String urldisplay = urls[0]; | |
Bitmap mIcon11 = null; | |
try { | |
InputStream in = new java.net.URL(urldisplay).openStream(); | |
mIcon11 = BitmapFactory.decodeStream(in); | |
} catch (Exception e) { | |
Log.e("Error", e.getMessage()); | |
e.printStackTrace(); | |
} | |
return mIcon11; | |
} | |
protected void onPostExecute(Bitmap result) { | |
bmImage.setImageBitmap(result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment