[android-developers] Re: Displaying image from internet source
We won't know what's going on unless you show us a strack-trace of the error. :=) Look at LogCat and copy/paste the strack-trace in this thread. All i can do now is guess: How big is your image? You create two arrays (int[] and byte[]) which are never used. This is memory waste. The inputstream 'is' may hold a large image as well. You may have gotten a out-of-memory error or an error occurring because you exceeded the allowed bitmap allocation budget. On Mar 23, 11:49 am, murphy howt...@hotmail.com wrote: Hi, I'm trying to display an image using a URL. When I run the code I get an error telling me the application has stopped unexpectedly. Can anyone see what's wrong in my code. Bitmap bmImg; URL myFileUrl =null; try { myFileUrl= new URL(http://www.starling-fitness.com/wp-content/ 240384vBdA_w.jpg); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { URLConnection conn= (URLConnection)myFileUrl.openConnection(); conn.setDoInput(true); conn.connect(); int length = conn.getContentLength(); int[] bitmapData = new int[length]; byte[] bitmapData2 = new byte[length]; InputStream is = conn.getInputStream(); bmImg = BitmapFactory.decodeStream(is); /*timetableImage.setImageBitmap(bmImg);*/ setContentView(R.layout.timetable); ImageView iv = (ImageView)findViewById(R.id.timetableImage); iv.setImageBitmap(bmImg); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Displaying image from internet source
03-23 16:20:28.858: DEBUG/dalvikvm(91): GC freed 1176 objects / 62728 bytes in 81ms 03-23 16:20:36.965: DEBUG/skia(767): xx failure to skip request 2875 actual 1896 03-23 16:20:36.969: DEBUG/skia(767): xxx jpeg error 91 Miscellaneous marker 0x%02x, length %u 03-23 16:20:37.000: DEBUG/AndroidRuntime(767): Shutting down VM 03-23 16:20:37.000: WARN/dalvikvm(767): threadid=3: thread exiting with uncaught exception (group=0x40010e28) 03-23 16:20:37.000: ERROR/AndroidRuntime(767): Uncaught handler: thread main exiting due to uncaught exception 03-23 16:20:37.189: DEBUG/dalvikvm(767): GC freed 1718 objects / 425896 bytes in 151ms 03-23 16:20:37.199: ERROR/AndroidRuntime(767): java.lang.NullPointerException 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.organiser.college.CollegeOrganiser$3.onClick(CollegeOrganiser.java: 145) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.View.performClick(View.java:2109) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.View.onTouchEvent(View.java:3523) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.widget.TextView.onTouchEvent(TextView.java:4410) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.View.dispatchTouchEvent(View.java:3178) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.policy.impl.PhoneWindow $DecorView.superDispatchTouchEvent(PhoneWindow.java:1561) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1085) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.app.Activity.dispatchTouchEvent(Activity.java:1873) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.policy.impl.PhoneWindow $DecorView.dispatchTouchEvent(PhoneWindow.java:1545) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewRoot.handleMessage(ViewRoot.java:1140) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.os.Handler.dispatchMessage(Handler.java:88) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.os.Looper.loop(Looper.java:123) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.app.ActivityThread.main(ActivityThread.java:3742) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at java.lang.reflect.Method.invokeNative(Native Method) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at java.lang.reflect.Method.invoke(Method.java:515) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:739) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at dalvik.system.NativeStart.main(Native Method) 03-23 16:20:37.280: INFO/Process(51): Sending signal. PID: 767 SIG: 3 03-23 16:20:37.299: INFO/dalvikvm(767): threadid=7: reacting to signal 3 03-23 16:20:37.418: INFO/dalvikvm(767): Wrote stack trace to '/data/ anr/traces.txt' 03-23 16:20:38.829: INFO/Process(767): Sending signal. PID: 767 SIG: 9 03-23 16:20:38.901: INFO/ActivityManager(51): Process com.organiser.college (pid 767) has died. 03-23 16:20:39.030: INFO/WindowManager(51): WIN DEATH: Window{4342f180 com.organiser.college/com.organiser.college.CollegeOrganiser} I have pretty much no idea what any of that stuff means. On Mar 23, 4:05 pm, Streets Of Boston flyingdutc...@gmail.com wrote: We won't know what's going on unless you show us a strack-trace of the error. :=) Look at LogCat and copy/paste the strack-trace in this thread. All i can do now is guess: How big is yourimage? You create two arrays (int[] and byte[]) which are never used. This is memory waste. The inputstream 'is' may hold a largeimageas well. You may have gotten a out-of-memory error or an error occurring because you exceeded the allowed bitmap allocation budget. On Mar 23, 11:49 am, murphy howt...@hotmail.com wrote: Hi, I'm trying to display animageusing a URL. When I run the code I get an error telling me the application has stopped unexpectedly. Can anyone see what's wrong in my code. Bitmap bmImg; URL myFileUrl =null; try { myFileUrl= new URL(http://www.starling-fitness.com/wp-content/ 240384vBdA_w.jpg); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace();
[android-developers] Re: Displaying image from internet source
These two items stand out, with the most important one here: 03-23 16:20:37.199: ERROR/AndroidRuntime(767): java.lang.NullPointerException 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.organiser.college.CollegeOrganiser$3.onClick (CollegeOrganiser.java: 145) Your CollegeOrganiser class throws a null-pointer exception in an onClick method on line 145. You may want to solve this issue first. The other error: 03-23 16:20:36.965: DEBUG/skia(767): xx failure to skip request 2875 actual 1896 03-23 16:20:36.969: DEBUG/skia(767): xxx jpeg error 91 Miscellaneous marker 0x%02x, length %u may be a problem. Althouhg, i've seen these debug-messages before and all worked fine anyway. Any google-engineer want to chime in :-)? On Mar 23, 12:21 pm, murphy howt...@hotmail.com wrote: 03-23 16:20:28.858: DEBUG/dalvikvm(91): GC freed 1176 objects / 62728 bytes in 81ms 03-23 16:20:36.965: DEBUG/skia(767): xx failure to skip request 2875 actual 1896 03-23 16:20:36.969: DEBUG/skia(767): xxx jpeg error 91 Miscellaneous marker 0x%02x, length %u 03-23 16:20:37.000: DEBUG/AndroidRuntime(767): Shutting down VM 03-23 16:20:37.000: WARN/dalvikvm(767): threadid=3: thread exiting with uncaught exception (group=0x40010e28) 03-23 16:20:37.000: ERROR/AndroidRuntime(767): Uncaught handler: thread main exiting due to uncaught exception 03-23 16:20:37.189: DEBUG/dalvikvm(767): GC freed 1718 objects / 425896 bytes in 151ms 03-23 16:20:37.199: ERROR/AndroidRuntime(767): java.lang.NullPointerException 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.organiser.college.CollegeOrganiser$3.onClick(CollegeOrganiser.java: 145) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.View.performClick(View.java:2109) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.View.onTouchEvent(View.java:3523) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.widget.TextView.onTouchEvent(TextView.java:4410) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.View.dispatchTouchEvent(View.java:3178) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:857) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.policy.impl.PhoneWindow $DecorView.superDispatchTouchEvent(PhoneWindow.java:1561) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1085) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.app.Activity.dispatchTouchEvent(Activity.java:1873) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.policy.impl.PhoneWindow $DecorView.dispatchTouchEvent(PhoneWindow.java:1545) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.view.ViewRoot.handleMessage(ViewRoot.java:1140) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.os.Handler.dispatchMessage(Handler.java:88) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.os.Looper.loop(Looper.java:123) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at android.app.ActivityThread.main(ActivityThread.java:3742) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at java.lang.reflect.Method.invokeNative(Native Method) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at java.lang.reflect.Method.invoke(Method.java:515) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:739) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 03-23 16:20:37.199: ERROR/AndroidRuntime(767): at dalvik.system.NativeStart.main(Native Method) 03-23 16:20:37.280: INFO/Process(51): Sending signal. PID: 767 SIG: 3 03-23 16:20:37.299: INFO/dalvikvm(767): threadid=7: reacting to signal 3 03-23 16:20:37.418: INFO/dalvikvm(767): Wrote stack trace to '/data/ anr/traces.txt' 03-23 16:20:38.829: INFO/Process(767): Sending signal. PID: 767 SIG: 9 03-23 16:20:38.901: INFO/ActivityManager(51): Process com.organiser.college (pid 767) has died. 03-23 16:20:39.030: INFO/WindowManager(51): WIN DEATH: Window{4342f180 com.organiser.college/com.organiser.college.CollegeOrganiser} I have pretty much no idea what any of that stuff means. On Mar 23, 4:05 pm, Streets Of Boston flyingdutc...@gmail.com wrote: We won't know what's going on unless you show us a strack-trace of the error. :=) Look at LogCat and copy/paste the strack-trace in this thread.