Saturday, March 26, 2011

Re: [android-developers] display image from net

welll i have solved dis one now i am using following code

       
        Bitmap bitmap = null;
        InputStream in = null;       
        try {
           
              URL url = new URL(URL);  
              URLConnection conn = url.openConnection();
             /* HttpsURLConnection cone = url.*/
              conn.connect();
              in = conn.getInputStream();
            bitmap = BitmapFactory.decodeStream(in);
            in.close();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        return bitmap;               
   

But the problem occuring is dat my url is https and it is giving me an ssl error


On Sat, Mar 26, 2011 at 2:06 PM, Abhishek Talwar <r.o.b.i.n.abhishek@gmail.com> wrote:
this may be more like a java question

I just want to display an image placed on server onto my imageView

The following is the code which m using :--


       ImageView iv;
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       iv=(ImageView)findViewById(R.id.iv);
       String stringURL = "https://graph.facebook.com/618306968/
picture?access_token
" +
               "=103931556876|6ad1235e03c6472b20430aad-618306968|
cDUe563_MNfHUeUiTpqqh8mB0o8";

       InputStream is = null;
       BufferedInputStream bis = null;
       Bitmap bmp = null;

        try {
            URL url = new URL(stringURL);
            URLConnection conn = url.openConnection();
            conn.connect();
            is = conn.getInputStream();
            bis = new BufferedInputStream(is);
            bmp = BitmapFactory.decodeStream(bis);

             } catch (MalformedURLException e) {

               } catch (IOException e) {

                 }catch (Exception e) {

                    } finally {
   try {
       if( is != null )
           is.close();
       if( bis != null )
           bis.close();
   } catch (IOException e) {

   }
}
iv.setImageBitmap(bmp);

   }


I am not getting any error but also my imageview is empty and is not
showing anything

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment