If it's anything like Java SE, then this (untested) will get you SSL (j.n.*
classes don't automatically do the right thing with https, btw):
static public Bitmap fromUrl(String urlStr) throws Exception {
Bitmap bitmap = null;
InputStream in = null;
try {
SocketFactory socketFactory = SSLSocketFactory.getDefault();
Socket socket = socketFactory.createSocket(urlStr, 80);
in = socket.getInputStream();
bitmap = BitmapFactory.decodeStream(in);
} finally {
if (in != null)
in.close();
}
return bitmap;
}
HTH
Thanks,
Josh
----- Original Message -----
From: "Robin Talwar" <[email protected]>
To: [email protected]
Cc: "Oscar" <[email protected]>
Sent: Sunday, March 27, 2011 10:52:42 PM
Subject: Re: [android-developers] Re: display image from net
i dont think so i am just trying to show the user's facebook dp on my
application when he logs into facebook using dialog interface.
I have read the facebook sdk for android and i am able to fetch all data from
user profile
To get the image from the net i have to get the image from following link :-
https://graph.facebook.com/ USERID /picture?
and this is where i am stuck
i dont think so that i require any username or password it is just something in
coding .
On Mon, Mar 28, 2011 at 9:57 AM, Oscar < [email protected] > wrote:
that's fine, Does the ssl use user/password?
On Mar 26, 3:49 am, Robin Talwar < [email protected] > wrote:
> 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 <
>
>
>
>
>
>
>
> [email protected] > 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 [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en