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..
Related
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 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.
I am using the codes below but my app force closes independently which one use. These are from several examples found on the net but none of them is working:
The semes2 variable is a phone number retrieved from the ContactsContract and is not null (verified by Toast msg).
Uri uri = Uri.fromParts("tel", semes2, null);
Intent callIntent = new Intent(Intent.ACTION_CALL, uri);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(callIntent);
or
Intent dialIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:6365551212"));
startActivity(dialIntent);
or
Intent dialIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel://" + semes2));
dialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(dialIntent);
In the manifest i have <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
What am i missing?
Edit: logcat:
05-24 05:46:17.404: ERROR/AndroidRuntime(272): FATAL EXCEPTION: main
05-24 05:46:17.404: ERROR/AndroidRuntime(272): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.CALL dat=tel://+36301111111 cmp=com.android.phone/.OutgoingCallBroadcaster } from ProcessRecord{43f8e500 272:com.bfarago.nevnap/10048} (pid=272, uid=10048) requires android.permission.CALL_PHONE
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.os.Parcel.readException(Parcel.java:1247)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.os.Parcel.readException(Parcel.java:1235)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1298)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.app.Activity.startActivityForResult(Activity.java:2817)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.app.Activity.startActivity(Activity.java:2923)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at com.bfarago.nevnap.MainActivity$1$1$1.onClick(MainActivity.java:1363)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:874)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.widget.ListView.performItemClick(ListView.java:3382)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.os.Handler.handleCallback(Handler.java:587)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.os.Handler.dispatchMessage(Handler.java:92)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.os.Looper.loop(Looper.java:123)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at java.lang.reflect.Method.invokeNative(Native Method)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at java.lang.reflect.Method.invoke(Method.java:521)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-24 05:46:17.404: ERROR/AndroidRuntime(272): at dalvik.system.NativeStart.main(Native Method)
05-24 05:46:17.564: WARN/ActivityManager(58): Force finishing activity com.bfarago.nevnap/.MainActivity
05-24 05:46:18.224: WARN/ActivityManager(58): Activity pause timeout for HistoryRecord{44011768 com.bfarago.nevnap/.MainActivity}
05-24 05:46:19.754: INFO/Process(272): Sending signal. PID: 272 SIG: 9
05-24 05:46:19.816: INFO/ActivityManager(58): Process com.bfarago.nevnap (pid 272) has died.
05-24 05:46:19.844: WARN/ActivityManager(58): Scheduling restart of crashed service com.bfarago.nevnap/.UpdateService in 5000ms
05-24 05:46:19.864: INFO/WindowManager(58): WIN DEATH: Window{43fac220 com.bfarago.nevnap/com.bfarago.nevnap.MainActivity paused=false}
05-24 05:46:19.864: INFO/WindowManager(58): WIN DEATH: Window{440383a8 com.bfarago.nevnap/com.bfarago.nevnap.MainActivity paused=false}
05-24 05:46:19.954: WARN/InputManagerService(58): Got RemoteException sending setActive(false) notification to pid 272 uid 10048
05-24 05:46:21.110: WARN/NotificationService(58): Object died trying to hide notification android.app.ITransientNotification$Stub$Proxy#43edd2c0 in package com.bfarago.nevnap
05-24 05:46:21.114: WARN/ActivityManager(58): setProcessForeground called on unknown pid: 272
05-24 05:46:24.944: INFO/ActivityManager(58): Start proc com.bfarago.nevnap for service com.bfarago.nevnap/.UpdateService: pid=286 uid=10048 gids={1015}
05-24 05:46:29.200: WARN/ActivityManager(58): Activity destroy timeout for HistoryRecord{44011768 com.bfarago.nevnap/.MainActivity}
05-24 05:46:30.605: DEBUG/dalvikvm(162): GC_EXPLICIT freed 2438 objects / 143352 bytes in 192ms
Found the solution. Instead of ACTION_CALL i should have used ACTION_DIAL. I can also remove the // after tel:, it doesn't matter. So e.g.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + semes2));
startActivity(intent);
However, the 2nd example is still force closes even though it has ACTION DIAL.
You should include the following permission android.permission.CALL_PHONE in your android manifest file :
<uses-permission android:name="android.permission.CALL_PHONE"/>
I have an app that obtains a list of available Calendars and displays
them in the Spinner.
I have checks to ensure that if the available Calendar list is empty,
then ListPreference will still display "None available" in the Spinner.
I am using the ListPreference to display the Spinner in the
Preferences tab.
Here is the preferences.xml:
<ListPreference android:title="Calendar"
android:key="calendars"
android:summary="Calendars to use for saving Appts"
android:selectable="true"
android:entryValues="#array/cal_entryvalues_list_preference"
android:entries="#array/cal_entries_list_preference"
android:defaultValue="0"
android:enabled="true"></ListPreference>
My users have reported the following error:
java.lang.NullPointerException
at
android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:
355)
at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
at android.widget.AbsListView.obtainView(AbsListView.java:1294)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
at android.widget.ListView.onMeasure(ListView.java:1109)
at android.view.View.measure(View.java:8171)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:
1012)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8171)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:
1012)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at
com.android.internal.widget.WeightedLinearLayout.onMeasure(WeightedLinearLayout.java:
60)
at android.view.View.measure(View.java:8171)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8171)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8171)
at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
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:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
The stack trace seems to be pointed all internal workings of Android.
There is no reference to any of my code. This is happening on
Android 2.1 as well as Android 2.2 platforms.
Unfortunately, I have not been able to reproduce the error on my Moto
Droid. It appears from Developer Console logs that this is specific to
certain phones (e.g: HTC Incredible).
Any idea what is going on here?
Got a trace like this:
java.lang.StackOverflowError
at android.widget.TextView.onMeasure(TextView.java:5160)
at android.view.View.measure(View.java:8172)
at android.widget.TableRow.getColumnsWidths(TableRow.java:308)
at android.widget.TableLayout.findLargestCells(TableLayout.java:497)
at android.widget.TableLayout.measureVertical(TableLayout.java:462)
at android.widget.TableLayout.onMeasure(TableLayout.java:428)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:696)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:306)
at android.view.View.measure(View.java:8172)
at android.widget.ListView.measureScrapChild(ListView.java:1135)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1200)
at android.widget.ListView.onMeasure(ListView.java:1109)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8172)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8172)
at android.view.ViewRoot.performTraversals(ViewRoot.java:805)
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)
Is there anything that can be done here?
I'm getting reports of blank screens and force closes.
When stack traces don't help the best thing you can do is trace it.
Start to scatter log messages through strategic parts of your application, and once you find where it is set some breakpoints and step through.
Log.d("MyActivity", "MyClass.getView() — Initializing ");
Once you have your logs setup use LogCat