android - Why can't picasso load my url? Always defaulting to onError. -
here oncreate of myactivity thats gonna use picasso:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); string url = "http://s3.amazonaws.com/snappie.watermarks/crssd.png"; sticker = (imageview)findviewbyid(r.id.sticker); picasso.with(getapplicationcontext()).setloggingenabled(true); framelayout camera_layout =(framelayout)findviewbyid(r.id.fragment_container); previewwidth = camera_layout.getwidth(); log.d("width","width is"+previewwidth); picasso.with(this).load(url).into(sticker,new callback() { @override public void onsuccess() { mybitmap = ((bitmapdrawable) sticker.getdrawable()).getbitmap(); int width = (mybitmap.getwidth() * previewwidth) / 1080; int height = (mybitmap.getheight() * previewwidth) / 1080; scaledbitmap = bitmap.createscaledbitmap(mybitmap, width, height, false); sticker.setimagebitmap(scaledbitmap); //savebitmap(mybitmap); } @override public void onerror() { bitmap bm = bitmapfactory.decoderesource(getresources(), r.drawable.balloons); sticker.setimagebitmap(bm); } }); }
it pretty defaults balloons (from onerror).
here log:
05-31 12:04:22.705 6610-6610/com.snappiesticker.cwac4 d/picasso﹕ main created [r0] request{http://s3.amazonaws.com/snappie.watermarks/crssd.png} 05-31 12:04:22.709 6610-6629/com.snappiesticker.cwac4 d/picasso﹕ dispatcher enqueued [r0]+4ms 05-31 12:04:22.714 6610-6631/com.snappiesticker.cwac4 d/picasso﹕ hunter executing [r0]+10ms 05-31 12:04:22.732 6610-6629/com.snappiesticker.cwac4 d/picasso﹕ dispatcher batched [r0]+28ms error 05-31 12:04:22.815 6610-6653/com.snappiesticker.cwac4 d/openglrenderer﹕ use egl_swap_behavior_preserved: true 05-31 12:04:22.822 6610-6610/com.snappiesticker.cwac4 d/atlas﹕ validating map... 05-31 12:04:22.856 6610-6653/com.snappiesticker.cwac4 i/adreno-egl﹕ <qegldrvapi_eglinitialize:379>: qualcomm build: 01/14/15, ab0075f, id3510ff6dc 05-31 12:04:22.857 6610-6653/com.snappiesticker.cwac4 i/openglrenderer﹕ initialized egl, version 1.4 05-31 12:04:22.879 6610-6653/com.snappiesticker.cwac4 d/openglrenderer﹕ enabling debug mode 0 05-31 12:04:22.966 6610-6629/com.snappiesticker.cwac4 d/picasso﹕ dispatcher delivered [r0]+261ms 05-31 12:04:22.977 6610-6610/com.snappiesticker.cwac4 d/picasso﹕ main errored [r0]+272ms
if try url manually can tell real , exists. going on here?
it looks good, missed internet use-permission. add
<uses-permission android:name="android.permission.internet" />
to androidmanifest.xml
Comments
Post a Comment