Why I can't open my camera? - android

I try to run this , but it force close happen like this
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): java.lang.RuntimeException: Fail to connect to camera service
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.hardware.Camera.native_setup(Native Method)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.hardware.Camera.<init>(Camera.java:294)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.hardware.Camera.open(Camera.java:271)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at com.example.Preview.surfaceCreated(Preview.java:37)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.SurfaceView.updateWindow(SurfaceView.java:543)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:348)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.View.draw(View.java:6936)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.widget.FrameLayout.draw(FrameLayout.java:357)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.View.draw(View.java:6936)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.widget.FrameLayout.draw(FrameLayout.java:357)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1904)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewRoot.draw(ViewRoot.java:1527)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewRoot.performTraversals(ViewRoot.java:1263)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.os.Handler.dispatchMessage(Handler.java:99)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.os.Looper.loop(Looper.java:123)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at android.app.ActivityThread.main(ActivityThread.java:3687)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at java.lang.reflect.Method.invokeNative(Native Method)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at java.lang.reflect.Method.invoke(Method.java:507)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
06-29 10:14:14.154: ERROR/AndroidRuntime(4392): at dalvik.system.NativeStart.main(Native Method)

Sounds like your device does not have a camera (emulator!) or that you dont have the appropriate permissions defined in your manifest.
android.permission.CAMERA

I think the problem is in your device, because the tutorial has ask you to add the permission. Edit your AVD and add camera support in hardware

Related

Using Images of high resolution gives an BITMAP error?

I have created an application which consists of only ImageViews.
Also According to the app requirement I had to use Hi Quality Images with 1024*780 Resolution through 200*250 resolution Images. All Images sums up to almost 45 images!!!.
In High-End (Heap memory >=32)Devices, I found it is running Smoothly, Coming to the low end (Heap memory <32) devices & also on MICROMAX A 65, I received Some Crashing Reports & I gave a try on a 16mb heap memory Emulator.
After Clicking first Image it is showing:
06-29 05:16:28.572: W/dalvikvm(846): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
06-29 05:16:28.665: E/AndroidRuntime(846): FATAL EXCEPTION: main
06-29 05:16:28.665: E/AndroidRuntime(846): java.lang.OutOfMemoryError
06-29 05:16:28.665: E/AndroidRuntime(846): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.content.res.Resources.loadDrawable(Resources.java:1965)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.content.res.Resources.getDrawable(Resources.java:660)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.widget.ImageView.resolveUri(ImageView.java:616)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.widget.ImageView.setImageResource(ImageView.java:349)
06-29 05:16:28.665: E/AndroidRuntime(846): at com.mshah.learnandplaybasiccolors.Learn.setImageWithSound(Learn.java:123)
06-29 05:16:28.665: E/AndroidRuntime(846): at com.mshah.learnandplaybasiccolors.Learn.onClick(Learn.java:88)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.view.View.performClick(View.java:4202)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.view.View$PerformClick.run(View.java:17340)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.os.Handler.handleCallback(Handler.java:725)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.os.Handler.dispatchMessage(Handler.java:92)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.os.Looper.loop(Looper.java:137)
06-29 05:16:28.665: E/AndroidRuntime(846): at android.app.ActivityThread.main(ActivityThread.java:5039)
06-29 05:16:28.665: E/AndroidRuntime(846): at java.lang.reflect.Method.invokeNative(Native Method)
06-29 05:16:28.665: E/AndroidRuntime(846): at java.lang.reflect.Method.invoke(Method.java:511)
06-29 05:16:28.665: E/AndroidRuntime(846): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-29 05:16:28.665: E/AndroidRuntime(846): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-29 05:16:28.665: E/AndroidRuntime(846): at dalvik.system.NativeStart.main(Native Method)
I am not using Bitmap, It is giving the bitmap error: How can I resolve this error ???
or
Should I exclude the support for such devices?
You shouldn't load all these images into memory at the same time. Why would you? You should create some gallery of thumbnails or something along those lines and lazy load as needed. There is no way around this. You're going to run out of memory loading images the way you're doing, even on the high end devices since android only gives you a very small memory footprint within which to operate.
Managing bitmap memory
this doc is helping a lot regarding bitmap issue.

Stackoverflow: Caused by nested views?

I'm having a crash when refreshing a view inside a SlidingTray (custom SlidingDrawer coming from the top).
I'm not sure what causing it.. but my first guess is that it's due to the number of nested layouts...
What is the maximum number of nested layouts?
Is it device specific, how can I be sure if that's the cause?
If it's not, any of these things is causing it.. what is?
The stacktrace:
E/AndroidRuntime( 2199): FATAL EXCEPTION: main
E/AndroidRuntime( 2199): java.lang.StackOverflowError
E/AndroidRuntime( 2199): at android.graphics.Paint.measureText(Paint.java:1057)
E/AndroidRuntime( 2199): at android.text.Styled.drawDirectionalRun(Styled.java:267)
E/AndroidRuntime( 2199): at android.text.Styled.measureText(Styled.java:430)
E/AndroidRuntime( 2199): at android.text.Layout.measureText(Layout.java:1655)
E/AndroidRuntime( 2199): at android.text.Layout.getLineMax(Layout.java:689)
E/AndroidRuntime( 2199): at android.text.Layout.draw(Layout.java:340)
E/AndroidRuntime( 2199): at android.text.BoringLayout.draw(BoringLayout.java:365)
E/AndroidRuntime( 2199): at android.widget.TextView.onDraw(TextView.java:4168)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6880)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at android.widget.ScrollView.draw(ScrollView.java:1409)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.buildDrawingCache(View.java:6640)
E/AndroidRuntime( 2199): at android.view.View.getDrawingCache(View.java:6428)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1571)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1392)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at android.widget.ScrollView.draw(ScrollView.java:1409)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6986)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at android.widget.HorizontalScrollView.draw(HorizontalScrollView.java:1409)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at com.vodafone.onm.components.SlidingTray.dispatchDraw(SlidingTray.java:426)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
E/AndroidRuntime( 2199): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
E/AndroidRuntime( 2199): at android.view.View.draw(View.java:6883)
E/AndroidRuntime( 2199): at android.widget.FrameLayout.draw(FrameLayout.java:357)
E/AndroidRuntime( 2199): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java)
UPDATE:
Hierarchy Viewer Snapshot
http://d.pr/kXnp
.
Some thinks I think are related:
http://www.mail-archive.com/android-developers#googlegroups.com/msg48036.html
What is the maximum number of nested layouts?
There is no specific value. You run out of stack space when you run out of stack space, and that will be contingent upon what you are doing. The main application thread has an 8KB stack, last I heard.
That being said, if Hierarchy View is showing a depth of 10 or more (root to deepest leaf), I start to get nervous, and by 15 you are likely to start running into exceptions. Your image, which is nearly illegible, appears to have a depth substantially higher than that.
You seem to have a number of wasted layers. If you have a layer in Hierarchy View, on the critical path, that has one parent and one child, that is a prime candidate to be removed, as it may not be adding any value. You have at least 5 of these candidates. Even cleaning all of that up may not be sufficient, but it is a starting point.

What is this error while building a project in android?

I get this error !! Class Not found ..
please check the following error log
06-29 09:09:59.384: ERROR/AndroidRuntime(545): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{s.s/s.s.MainActivity}: java.lang.ClassNotFoundException: s.s.MainActivity in loader dalvik.system.PathClassLoader[/data/app/s.s-2.apk]
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1544)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at android.os.Handler.dispatchMessage(Handler.java:99)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at android.os.Looper.loop(Looper.java:123)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at android.app.ActivityThread.main(ActivityThread.java:3647)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at java.lang.reflect.Method.invokeNative(Native Method)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at java.lang.reflect.Method.invoke(Method.java:507)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at dalvik.system.NativeStart.main(Native Method)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): Caused by: java.lang.ClassNotFoundException: s.s.MainActivity in loader dalvik.system.PathClassLoader[/data/app/s.s-2.apk]
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1536)
06-29 09:09:59.384: ERROR/AndroidRuntime(545): ... 11 more
Well, it means that the class is not found :-)
Do you have a class called s.s.MainActivity? Have you misspelled it (disagreement in the spelling between your manifest and source?). Are you accidentally stripping it out of your apk with ProGuard?
Have a look at your Manifestfile... I think not adding the activity there, would cause this problem.
Should look something like this:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

java.lang.OutOfMemoryError bitmap create?

I just got this stack trace from the marketplace error reporting and have no idea where to being to track the problem down, any help appreciated.
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:463)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:326)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1709)
at android.content.res.Resources.getDrawable(Resources.java:581)
at com.android.internal.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:440)
at com.android.internal.view.menu.IconMenuItemView.initialize(IconMenuItemView.java:109)
at com.android.internal.view.menu.MenuItemImpl.createItemView(MenuItemImpl.java:594)
at com.android.internal.view.menu.MenuItemImpl.getItemView(MenuItemImpl.java:577)
at com.android.internal.view.menu.IconMenuView.updateChildren(IconMenuView.java:351)
at com.android.internal.view.menu.IconMenuView.initialize(IconMenuView.java:333)
at com.android.internal.view.menu.MenuBuilder$MenuType.getMenuView(MenuBuilder.java:199)
at com.android.internal.view.menu.MenuBuilder.getMenuView(MenuBuilder.java:323)
at com.android.internal.policy.impl.PhoneWindow.initializePanelContent(PhoneWindow.java:858)
at com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java:435)
at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:621)
at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1339)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1668)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at android.widget.TabHost.dispatchKeyEvent(TabHost.java:278)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1687)
at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1120)
at android.app.Activity.dispatchKeyEvent(Activity.java:2073)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1663)
at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2560)
at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2535)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1867)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3647)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
I'm getting the same error on an application I've developed for Android 2.1 and Android 2.2 but run on Android 4.0.1 ICS. The same app would run on Android 2.1 but cause a crash with the above error on ICS. If you're drawing something relatively big to the size of the screen, consider checking from that place.

NullPointerException app loading

When my app loads the following error comes up on some devices. It refers to none of my source files at all! How do I go about fixing this one?
java.lang.NullPointerException
at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:42)
at com.google.android.maps.MapView.onDraw(MapView.java:494)
at android.view.View.draw(View.java:6739)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1872)
at android.view.ViewRoot.draw(ViewRoot.java:1422)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1167)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
As mentioned here: Marking Current Location on Map, Android and here http://code.google.com/p/android/issues/detail?id=2035, you may need to call overlays.populate(); method in your code.

Categories

Resources