Android - Extra-weird uncaught exception on a basic activity
I can't figure out what it is going on here...after hours...
This is the activity in question (that I have made super-easy in order to narrow down the problem):
public class UserAuthenticationActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Log.e("MYAPP", "step1");
super.onCreate(savedInstanceState);
setContentView(R.layout.user_authentication);
Log.e("MYAPP", "step2");
}
@Override
public void onStart()
{
super.onStart();
}
}
And this is layout/user_authentication:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:padding="15sp"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="hello!"
android:paddingTop="15sp"
android开发者_Python百科:paddingBottom="5sp"
android:textSize="15sp"
/>
</LinearLayout>
</ScrollView>
I get the error screen when I launch the application. The log doesn't show my debug messages but just this exception:
I/ActivityManager( 1032): Starting activity: Intent { comp={com.myapp.android.app/com.myapp.android.app.activity.UserAuthenticationActivity} }
D/Database( 1990): hook db is called for:/data/data/com.myapp.android.app/databases/myappDatabase.db
D/Database( 1990): hook not enabled for /data/data/com.myapp.android.app/databases/myappDatabase.db
E/QC-DSS-LIB( 981): unrecognized ifindex 6
W/dalvikvm( 1990): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
E/AndroidRuntime( 1990): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 1990): java.lang.NullPointerException
E/AndroidRuntime( 1990): at android.widget.ListView.measureScrapChild(ListView.java:1039)
E/AndroidRuntime( 1990): at android.widget.ListView.measureHeightOfChildren(ListView.java:1120)
E/AndroidRuntime( 1990): at android.widget.ListView.onMeasure(ListView.java:1031)
E/AndroidRuntime( 1990): at android.view.View.measure(View.java:7236)
E/AndroidRuntime( 1990): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2875)
E/AndroidRuntime( 1990): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
E/AndroidRuntime( 1990): at android.widget.LinearLayout.measureVertical(LinearLayout.java:350)
E/AndroidRuntime( 1990): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
E/AndroidRuntime( 1990): at android.view.View.measure(View.java:7236)
E/AndroidRuntime( 1990): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2875)
E/AndroidRuntime( 1990): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
E/AndroidRuntime( 1990): at android.view.View.measure(View.java:7236)
E/AndroidRuntime( 1990): at android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
E/AndroidRuntime( 1990): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
E/AndroidRuntime( 1990): at android.view.View.measure(View.java:7236)
E/AndroidRuntime( 1990): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2875)
E/AndroidRuntime( 1990): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
E/AndroidRuntime( 1990): at android.view.View.measure(View.java:7236)
E/AndroidRuntime( 1990): at android.view.ViewRoot.performTraversals(ViewRoot.java:698)
E/AndroidRuntime( 1990): at android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
E/AndroidRuntime( 1990): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1990): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1990): at android.app.ActivityThread.main(ActivityThread.java:3948)
E/AndroidRuntime( 1990): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1990): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1990): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime( 1990): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
E/AndroidRuntime( 1990): at dalvik.system.NativeStart.main(Native Method)
I hope somebody can help me. I don't have any clue.
Thanks,
DanCould it be because there is no contentview?
Further points of interest:
- There are several Views in your scrollview, but it can have only one child (use something like a linear layout to put more than 1 in there)
- How does your manifest look? What activities are declared there? (or, as @kcoppock said: is this your only activity?)
- Why is it throwing stuff from .widget? What are you using in e.g. imports?
精彩评论