Android Open Source - OpenFoodFinder Download Icon Task






From Project

Back to project page OpenFoodFinder.

License

The source code is released under:

Apache License

If you think the Android project OpenFoodFinder listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.kudos.off;
//  ww  w .j  a  va  2 s.co  m
import java.io.InputStream;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.ImageView;

public class DownloadIconTask extends AsyncTask<String, Void, Bitmap> {
  ImageView bmImage;
  
  public DownloadIconTask(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);
  }
}




Java Source Code List

com.kudos.off.DownloadIconTask.java
com.kudos.off.GPSLocation.java
com.kudos.off.GooglePlaces.java
com.kudos.off.MainActivity.java
com.kudos.off.Place.java
com.kudos.off.RestaurantPageActivity.java