Back to project page gridView.
The source code is released under:
Apache License
If you think the Android project gridView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.datayumyum.pos; // w w w . j a v a 2s. c o m import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.util.Log; import android.widget.ImageButton; import java.io.InputStream; public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> { private static final String TAG = "com.datayumyum.pos.DownloadImageTask"; private ImageButton imageButton; private String url; public DownloadImageTask(ImageButton imageButton) { this.imageButton = imageButton; } protected Bitmap doInBackground(String... urls) { url = urls[0]; Bitmap bitmap = null; try { InputStream in = new java.net.URL(url).openStream(); bitmap = BitmapFactory.decodeStream(in); } catch (Exception e) { Log.e(TAG, e.getMessage()); } return bitmap; } protected void onPostExecute(Bitmap result) { imageButton.setImageBitmap(result); Log.i(TAG, "loaded " + url); } }