gpt4 book ai didi

Android - 基本 Activity 中异常奇怪的未捕获异常

转载 作者:行者123 更新时间:2023-11-29 18:22:20 24 4
gpt4 key购买 nike

我不知道这里发生了什么......下类后......

这是有问题的 Activity (为了缩小问题范围,我已将其简化):

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();
}
}

这是布局/用户身份验证:

<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:paddingBottom="5sp"
android:textSize="15sp"
/>

</LinearLayout>

</ScrollView>

启动应用程序时出现错误屏幕。日志不显示我的调试消息,只显示这个异常:

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)

我希望有人能帮助我。我没有任何线索。

谢谢,

最佳答案

会不会是因为没有contentview?

其他兴趣点:

  • 您的 ScrollView 中有多个 View ,但它只能有一个 subview (使用线性布局之类的东西可以在其中放置多个 View )
  • 您的 list 看起来如何?那里宣布了哪些 Activity ? (或者,正如@kcoppock 所说:这是你唯一的 Activity 吗?)
  • 为什么它会从 .widget 中抛出东西?你在使用什么?进口?

关于Android - 基本 Activity 中异常奇怪的未捕获异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4739125/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com