I am new to android programming, and i wrote an app to add two integers. However, upon execution i recieve an error 'application (com.android.xxxx) has stopped unexpectedly. The log is as posted below. Please help me debug and understand the issue:
11-08 02:02:17.671: E/AndroidRuntime(328): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-08 02:02:17.671: E/AndroidRuntime(328): at dalvik.system.NativeStart.main(Native Method)
11-08 02:02:17.671: E/AndroidRuntime(328): Caused by: java.lang.NullPointerException
11-08 02:02:17.671: E/AndroidRuntime(328): at com.android.add.AdditionActivity.onCreate(AdditionActivity.java:17)
11-08 02:02:17.671: E/AndroidRuntime(328): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-08 02:02:17.671: E/AndroidRuntime(328): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-08 02:02:17.671: E/AndroidRuntime(328): ... 11 more
11-08 02:35:42.461: D/AndroidRuntime(1153): Shutting down VM
11-08 02:35:42.461: W/dalvikvm(1153): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-08 02:35:42.501: E/AndroidRuntime(1153): FATAL EXCEPTION: main
11-08 02:35:42.501: E/AndroidRuntime(1153): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.add/com.android.add.AdditionActivity}: java.lang.NullPointerException
11-08 02:35:42.501: E/AndroidRuntime(1153): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
11-08 02:35:42.501: E/AndroidRuntime(1153): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-08 02:35:42.501: E/AndroidRuntime(1153): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-08 02:35:42.501: E/AndroidRuntime(1153): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-08 02:35:42.501: E/AndroidRuntime(1153): at android.os.Handler.dispatchMessage(Handler.java:99)
11-08 02:35:42.501: E/AndroidRuntime(1153): at android.os.Looper.loop(Looper.java:123)
11-08 02:35:42.501: E/AndroidRuntime(1153): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-08 02:35:42.501: E/AndroidRuntime(1153): at java.lang.reflect.Method.invokeNative(Native Method)
11-08 02:35:42.501: E/AndroidRuntime(1153): at java.lang.reflect.Method.invoke(Method.java:521)
11-08 02:35:42.501: E/AndroidRuntime(1153): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-08 02:35:42.501: E/AndroidRuntime(1153): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-08 02:35:42.501: E/AndroidRuntime(1153): at dalvik.system.NativeStart.main(Native Method)
11-08 02:35:42.501: E/AndroidRuntime(1153): Caused by: java.lang.NullPointerException
11-08 02:35:42.501: E/AndroidRuntime(1153): at com.android.add.AdditionActivity.onCreate(AdditionActivity.java:17)
11-08 02:35:42.501: E/AndroidRuntime(1153): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-08 02:35:42.501: E/AndroidRuntime(1153): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-08 02:35:42.501: E/AndroidRuntime(1153): ... 11 more
You have a NullPointerException on line 17 of AdditionActivity.java, which prevents your activity from starting up.
Related
We tried integrating HelpStack by following steps given on GitHub, but we kept getting the following errors:
04-03 13:54:22.054 4638-4638/com.playerline.android E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.playerline.android/com.tenmiles.helpstack.activities.HomeActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4448)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.tenmiles.helpstack.activities.HSActivityParent.onCreate(HSActivityParent.java:48)
at com.tenmiles.helpstack.activities.HomeActivity.onCreate(HomeActivity.java:46)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4448)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
I'm guessing it has something to do with the App Theme, which in our case is is Theme.AppCompat.NoActionBar.
I have been trying to add three different activities each to a different tab ...
One activity is starting the bluetooth discovery and selection of a bluetooth device for pairing up
and second one will be a bluetooth based mousepad
i was following many online stuff ..basically this one http://www.androidhive.info/2011/08/android-tab-layout-tutorial/
But somehow it's showing this error
11-08 13:41:24.673: D/AndroidRuntime(22886): Shutting down VM
11-08 13:41:24.673: W/dalvikvm(22886): threadid=1: thread exiting with uncaught exception (group=0x40ab6228)
11-08 13:41:24.714: E/AndroidRuntime(22886): FATAL EXCEPTION: main
11-08 13:41:24.714: E/AndroidRuntime(22886): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kant.BluetoothTest2/com.kant.BluetoothTest2.TabControllerActivity}: java.lang.RuntimeException: Your TabHost must have a FrameLayout whose id attribute is 'android.R.id.tabcontent'
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2194)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2229)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.ActivityThread.access$600(ActivityThread.java:139)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.os.Handler.dispatchMessage(Handler.java:99)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.os.Looper.loop(Looper.java:154)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.ActivityThread.main(ActivityThread.java:4945)
11-08 13:41:24.714: E/AndroidRuntime(22886): at java.lang.reflect.Method.invokeNative(Native Method)
11-08 13:41:24.714: E/AndroidRuntime(22886): at java.lang.reflect.Method.invoke(Method.java:511)
11-08 13:41:24.714: E/AndroidRuntime(22886): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-08 13:41:24.714: E/AndroidRuntime(22886): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-08 13:41:24.714: E/AndroidRuntime(22886): at dalvik.system.NativeStart.main(Native Method)
11-08 13:41:24.714: E/AndroidRuntime(22886): Caused by: java.lang.RuntimeException: Your TabHost must have a FrameLayout whose id attribute is 'android.R.id.tabcontent'
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.widget.TabHost.setup(TabHost.java:163)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.widget.TabHost.setup(TabHost.java:182)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.TabActivity.onContentChanged(TabActivity.java:135)
11-08 13:41:24.714: E/AndroidRuntime(22886): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:281)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.Activity.setContentView(Activity.java:1885)
11-08 13:41:24.714: E/AndroidRuntime(22886): at com.kant.BluetoothTest2.TabControllerActivity.onCreate(TabControllerActivity.java:16)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.Activity.performCreate(Activity.java:4531)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
11-08 13:41:24.714: E/AndroidRuntime(22886): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2150)
11-08 13:41:24.714: E/AndroidRuntime(22886): ... 11 more
a help will be appreciated
As it says here :
11-08 13:41:24.714: E/AndroidRuntime(22886): Caused by: java.lang.RuntimeException: Your TabHost must have a FrameLayout whose id attribute is 'android.R.id.tabcontent'
You are missing the frameLayout with the correct id, So have a look at my code and try to do the same. Hope it helps :)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rootview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TabHost
android:id="#+id/mainTabHost"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</TabWidget>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include layout="#layout/view_offer_tab1" />
<include layout="#layout/view_offer_tab2" />
</FrameLayout>
</LinearLayout>
</TabHost>
I can't find following error in my code. It looks like the problem is in the asynctask onpostexecute.
java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:672)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:368)
at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
at android.app.Dialog.dismissDialog(Dialog.java:319)
at android.app.Dialog.dismiss(Dialog.java:302)
at www.mobilezar.mn.Advertisements$InitialLoading.onPostExecute(Advertisements.java:216)
at www.mobilezar.mn.Advertisements$InitialLoading.onPostExecute(Advertisements.java:1)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
15 reports
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oas.fruitkungfufree/com.openfeint.internal.ui.IntroFlow}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
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:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.openfeint.internal.Util.setOrientation(Util.java:36)
at com.openfeint.internal.ui.NestedWindow.onCreate(NestedWindow.java:32)
at com.openfeint.internal.ui.WebNav.onCreate(WebNav.java:93)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
Does any one have a solution for this??
This is a problem with your code, you can't use an object that is null. This is a hint.
I have this code on an Activity, I go back and again to this activity and update ArrayList datos.
{ArrayAdapter<String> adaptador =
new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, datos);
spinnerD = (Spinner)findViewById(R.id.spinner1);
adaptador.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerD.setAdapter(adaptador);
when I try to open the spinner after "reopening" the activity I get the following Error:
11-08 04:13:14.313: ERROR/AndroidRuntime(272): FATAL EXCEPTION: main
11-08 04:13:14.313: ERROR/AndroidRuntime(272): java.lang.NullPointerException
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:355)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.ArrayAdapter.getDropDownView(ArrayAdapter.java:376)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.Spinner$DropDownAdapter.getDropDownView(Spinner.java:329)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.Spinner$DropDownAdapter.getView(Spinner.java:325)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.AbsListView.obtainView(AbsListView.java:1294)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.ListView.onMeasure(ListView.java:1109)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.View.measure(View.java:8171)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.View.measure(View.java:8171)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at com.android.internal.widget.WeightedLinearLayout.onMeasure(WeightedLinearLayout.java:60)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.View.measure(View.java:8171)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.View.measure(View.java:8171)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.View.measure(View.java:8171)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.os.Handler.dispatchMessage(Handler.java:99)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.os.Looper.loop(Looper.java:123)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at java.lang.reflect.Method.invokeNative(Native Method)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at java.lang.reflect.Method.invoke(Method.java:521)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-08 04:13:14.313: ERROR/AndroidRuntime(272): at dalvik.system.NativeStart.main(Native Method)
11-08 04:13:16.052: ERROR/MetadataRetrieverClient(33): failed to extract an album art
spinnerD.setAdapter(adaptador1);
what is adaptador1, you are creating 'adaptador' and then you are setting adaptador1 to your spinnerD.setAdapter(adaptador1). is this correct ? 'adaptador1' might be null/empty..