Ok now i got this thing without any compile error :- SocketFactory socketFactory = SSLCertificateSocketFactory.getDefault(); Socket socket = socketFactory.createSocket(urlStr, 80); // *runtime System Error occurs at this line* in = socket.getInputStream(); bitmap = BitmapFactory.decodeStream(in);
but i have a runtime system error :- 03-28 14:11:46.062: WARN/System.err(3142): java.net.UnknownHostException: https://graph.facebook.com/618306968/picture? 03-28 14:11:46.062: WARN/System.err(3142): at java.net.InetAddress.lookupHostByName(InetAddress.java:513) 03-28 14:11:46.072: WARN/System.err(3142): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:278) 03-28 14:11:46.072: WARN/System.err(3142): at java.net.InetAddress.getAllByName(InetAddress.java:242) 03-28 14:11:46.072: WARN/System.err(3142): at java.net.Socket.tryAllAddresses(Socket.java:169) 03-28 14:11:46.072: WARN/System.err(3142): at java.net.Socket.<init>(Socket.java:258) 03-28 14:11:46.072: WARN/System.err(3142): at java.net.Socket.<init>(Socket.java:222) 03-28 14:11:46.072: WARN/System.err(3142): at javax.net.ssl.SSLSocket.<init>(SSLSocket.java:56) 03-28 14:11:46.072: WARN/System.err(3142): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.<init>(OpenSSLSocketImpl.java:174) 03-28 14:11:46.072: WARN/System.err(3142): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketFactoryImpl.createSocket(OpenSSLSocketFactoryImpl.java:65) 03-28 14:11:46.072: WARN/System.err(3142): at org.imagefromNet.imagefromNet.fromUrl(imagefromNet.java:50) 03-28 14:11:46.072: WARN/System.err(3142): at org.imagefromNet.imagefromNet.onCreate(imagefromNet.java:33) 03-28 14:11:46.072: WARN/System.err(3142): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069) 03-28 14:11:46.072: WARN/System.err(3142): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751) 03-28 14:11:46.072: WARN/System.err(3142): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803) 03-28 14:11:46.072: WARN/System.err(3142): at android.app.ActivityThread.access$2300(ActivityThread.java:135) 03-28 14:11:46.072: WARN/System.err(3142): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136) 03-28 14:11:46.072: WARN/System.err(3142): at android.os.Handler.dispatchMessage(Handler.java:99) 03-28 14:11:46.082: WARN/System.err(3142): at android.os.Looper.loop(Looper.java:144) 03-28 14:11:46.082: WARN/System.err(3142): at android.app.ActivityThread.main(ActivityThread.java:4937) 03-28 14:11:46.082: WARN/System.err(3142): at java.lang.reflect.Method.invokeNative(Native Method) 03-28 14:11:46.082: WARN/System.err(3142): at java.lang.reflect.Method.invoke(Method.java:521) 03-28 14:11:46.082: WARN/System.err(3142): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 03-28 14:11:46.082: WARN/System.err(3142): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 03-28 14:11:46.082: WARN/System.err(3142): at dalvik.system.NativeStart.main(Native Method) On Mon, Mar 28, 2011 at 2:02 PM, Robin Talwar <r.o.b.i.n.abhis...@gmail.com>wrote: > hey thanks but > > there are two socket factories > > - javax.net > - org.apache.http > > same goes for SSLSocketFactory > > - javax.net > - org.apache.http > > and if i use any permutation and combination :) i get an error on * > getdefault* method that it doesnt exist > > > On Mon, Mar 28, 2011 at 1:48 PM, Josh Long <starbux...@gmail.com> wrote: > >> >> 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" <r.o.b.i.n.abhis...@gmail.com> >> To: android-developers@googlegroups.com >> Cc: "Oscar" <oscar...@gmail.com> >> 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 < oscar...@gmail.com > wrote: >> >> >> that's fine, Does the ssl use user/password? >> >> >> On Mar 26, 3:49 am, Robin Talwar < r.o.b.i.n.abhis...@gmail.com > 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 < >> > >> > >> > >> > >> > >> > >> > >> >> >> >> > r.o.b.i.n.abhis...@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+unsubscr...@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+unsubscr...@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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en