Android get Image source from an https url?
<p>i am trying to get an image from a https url but it doesnt seem to display and get the image correctly but works fine on my computer browser.</p>

<p>i have tested out a http url pointing to a different image and it works fine.</p>

<p>my code is below:</p>

<pre><code>public Bitmap getContactPhoto(String url) {
        Bitmap pic = null;
        try {
            pic = BitmapFactory
                    .decodeStream((InputStream) new URL(
                            "https://mail.google.com/mail/photos/static/AD34hIjbK2m-Lj333E4nBcCkBC3MYl2tTs0xizuSqUOP3-Jd6DOrpFg1M5HG8jXh0MuPbeFepInZZDu92Dx8ST4b59EbOKmfYTortuuO3P1_Ohyu7b7a3gc")
                            .getContent());
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return pic;

    }
</code></pre>

<p>here is the code from the activity class that calls the method above:</p>

<pre><code>private ImageView mContactPhoto;
private ContactDetailsViewHelper mViewHelper;

mContactPhoto = (ImageView) findViewById(R.id.contact_photo);
mViewHelper = new ContactDetailsViewHelper(mContext);
mContactPhoto.setImageBitmap(mViewHelper.getContactPhoto(mDetail.getImageRef()));
</code></pre>

<p>ignore the mDetail.getImageRef, that passes the real url value but for this case i tried hard coding the url as you can see from the getContactPhoto method.</p>

<p>thanks</p>
