Android Open Source - wpaper Download Method






From Project

Back to project page wpaper.

License

The source code is released under:

MIT License

If you think the Android project wpaper 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 net;
/*from  ww  w  .j  a  va2 s.c  om*/
import java.io.InputStream;
import java.net.URL;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;

public class DownloadMethod {
  
  public DownloadMethod(){
    
  }
  
  public Bitmap DownloadImage(String urlstring){
    Bitmap image2bm = null;
    /*String urlstring = urls[0];*/
    try{
      InputStream in = new java.net.URL(urlstring).openStream();
      image2bm = BitmapFactory.decodeStream(in);

      //Bitmap picture2bm = BitmapFactory.decodeStream(url.openConnection().getInputStream());
      //Different method to open picture and download it------------------->>
      /*URL url = new URL("http://cdn.stupiddope.com/wp-content/uploads/2014/06/apple-logo1.jpg");
      Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());*/
      //imageView.setImageBitmap(bmp);
      
    }catch(Exception e){
      Log.e("Error", e.getMessage());
          e.printStackTrace();
    }
    //?W??????@???G?????A?????b?P?@??doInBackground
    return image2bm;
  }
}




Java Source Code List

com.example.uniwall.BitmapOperation.java
com.example.uniwall.CoViewPagerAdapter.java
com.example.uniwall.Controller.java
com.example.uniwall.MainActivity.java
com.example.uniwall.MainApplication.java
net.DownloadImageTask.java
net.DownloadMethod.java