Android Open Source - WiseRadar Image Downloader Thread






From Project

Back to project page WiseRadar.

License

The source code is released under:

Apache License

If you think the Android project WiseRadar 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 wiseguys.radar.conn;
//from w w w  . j a  v  a 2  s .  co m
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class ImageDownloaderThread extends Thread {

  private String Url;
  private Bitmap image;
  
  public ImageDownloaderThread(String URL) {
    this.Url = URL;
  }
  
  public Bitmap getImage() {
    if (this.isAlive()) {
      return null;
    } else {
      return image;
    }
  }
  
  /**
   * Downloads an image passed into the constructor via URL
   */
  public void run() {
    try {
          URL url = new URL(Url); //you can write here any link
          HttpURLConnection ucon = (HttpURLConnection)url.openConnection();
          InputStream is = ucon.getInputStream();
          
          image = BitmapFactory.decodeStream(is);
          
          is.close();                  
    } catch (IOException e) { }

  }

}




Java Source Code List

wiseguys.radar.ImageFetcher.java
wiseguys.radar.RadarHelper.java
wiseguys.radar.RadarLoader.java
wiseguys.radar.conn.GPSHelper.java
wiseguys.radar.conn.ImageDownloaderThread.java
wiseguys.radar.conn.SourceFetcherThread.java
wiseguys.radar.helpers.GPSHelper.java
wiseguys.radar.helpers.RadarHelper.java
wiseguys.radar.ui.AboutFragment.java
wiseguys.radar.ui.MainActivity.java
wiseguys.radar.ui.PrefFragment.java
wiseguys.radar.ui.RadarFragment.java
wiseguys.radar.ui.adapter.Compat.java
wiseguys.radar.ui.adapter.IPhotoView.java
wiseguys.radar.ui.adapter.PhotoViewAttacher.java
wiseguys.radar.ui.adapter.PhotoView.java
wiseguys.radar.ui.adapter.SDK16.java
wiseguys.radar.ui.adapter.ScrollerProxy.java
wiseguys.radar.ui.adapter.VersionedGestureDetector.java