7 Feb 2013

Download images,mp3,video from server in Android.

This is a method for Download image from server and display image in Imageview.


public void DownloadImageFromServer(final String imgurl)
      {      
         new Thread(new Runnable()
           {
             public void run()
              {
               try
                {
                 final Bitmap bitmap = BitmapFactory.decodeStream((InputStream) new URL(imgurl).getContent());
                   imgView.post(new Runnable()
                     {
                       @Override
                       public void run()
                      {
                         if(bitmap !=null)
                         {                                      

                            imgView.setImageBitmap(bitmap);                                          
                          }  

                       }
                      });


                 } 
                  catch (Exception e)
                  {}
               }
         }).start(); 
       }


More Ref Links:

http://www.coderzheaven.com/2012/04/26/upload-image-android-device-server-method-4/ 

http://androidsnips.blogspot.in/2010/08/upload-file-to-remote-server-in-android.html 

http://rorraja.blogspot.in/2012/05/upload-image-on-server-in-android.html 

http://vikaskanani.wordpress.com/2011/01/29/android-image-upload-activity/

Upload Imaged using Multipart:
http://www.androiddevelopersolution.com/2012/10/multipart-image-upload-in-android.html
http://infogani.blogspot.in/2013/04/uploading-image-to-server-path-using.html
http://www.androidhive.info/2014/12/android-uploading-camera-image-video-to-server-with-progress-bar/

I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.

Thank you :)

No comments:

Post a Comment