gpt4 book ai didi

android - 当我加载模拟器时它崩溃并说 "Unfortunately ' myapp' 已停止工作”

转载 作者:行者123 更新时间:2023-11-29 17:23:00 26 4
gpt4 key购买 nike

我创建了一个页面来显示关于我的应用程序的问题。我使用了滚动 TextView ,当我加载模拟器时出现一条错误消息,提示“不幸的是‘myapp’已停止工作”。该页面已添加到 list 中。提前谢谢你。

代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="katyloughrey5055.myapplication.QuestionsOnChapter7"
tools:showIn="@layout/activity_questions_on_chapter7">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Questions On Chapter 7 Differentiaion"
android:id="@+id/textView93"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />


<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Back"
android:id="@+id/Back5"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="44dp" />

<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
android:layout_below="@+id/textView93"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/textView93"
android:layout_alignEnd="@+id/textView93"
android:layout_above="@+id/Back5">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 1. A curve has equation : x² + 2xy – 3y² + 16 = 0. Find the coordinates of the points on the curve where dy/dx=0 2. A curve C is described by the equation :3x² + 4y² – 2x + 6xy – 5 = 0. Find an equation of the tangent to C at the point (1, –2). 3. A curve C is described by the equation 3x² – 2y² + 2x – 3y + 5 = 0. Find an equation of the normal to C at the point (0, 1). 4. A curve has parametric equations:x=7cost–cos7t, y= 7sint– sin7t, π/8&lt;t&lt;π/3. (a) Find an expression for in terms of t. You need not simplify your answer. (b) Find an equation of the normal to the curve at the point where t=π/6. Give your answer in its simplest exact form. 5. A set of curves is given by the equation sinx+cosy=0.5. (a) Use implicit differentiation to find an expression for dy/dx For -π&lt;x&lt;π -π&lt;y&lt;π (b) find the coordinates of the points where dy/dx=0. 6. A curve is described by the equation x³-4y²=12xy 7. (a) Find the coordinates of the two points on the curve where x = –8. (b) Find the gradient of the curve at each of these points. 8.A curve has equation 3x² – y² + xy = 4. The points P and Q lie on the curve. The gradient of the tangent to the curve is 83 at P and at Q . (a) Use implicit differentiation to show that y – 2x = 0 at P and at Q. (b) Find the coordinates of P and Q. 9.A curve C has the equation y² – 3y = x³ + 8. (a) Find dy/dx in terms of x and y. (b) Hence find the gradient of C at the point where y=3. 10.A curve is described by the equation x² + 4xy + y² + 27 = 0 (a) Find dy/dx in terms of x and y. A point Q lies on the curve. The tangent to the curve at Q is parallel to the y-axis.Given that the x coordinate of Q is negative, (b) use your answer to part (a) to find the coordinates of Q.&quot;"
android:id="@+id/textView5" />
</ScrollView>


</RelativeLayout>

日志:

 03-05 08:36:23.098 1921-1935/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0xacbcc8d0
03-05 08:36:23.185 243-269/? I/ActivityManager: Displayed katyloughrey5055.myapplication/.QuizOnChapter7: +1s221ms
03-05 08:37:03.573 1921-1935/? W/EGL_emulation: eglSurfaceAttrib not implemented
03-05 08:37:03.574 1921-1935/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa44f2280, error=EGL_SUCCESS
03-05 08:37:03.781 1921-1935/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0xacbcc2b0
03-05 08:37:05.765 243-548/? I/ActivityManager: START u0 {cmp=katyloughrey5055.myapplication/.QuestionsOnChapter7} from uid 10061 on display 0
03-05 08:37:06.898 1921-1921/? D/AndroidRuntime: Shutting down VM
03-05 08:37:06.907 1921-1921/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: katyloughrey5055.myapplication, PID: 1921
java.lang.RuntimeException: Unable to start activity ComponentInfo{katyloughrey5055.myapplication/katyloughrey5055.myapplication.QuestionsOnChapter7}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at katyloughrey5055.myapplication.QuestionsOnChapter7.onCreate(QuestionsOnChapter7.java:19)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
03-05 08:37:06.935 243-354/? W/ActivityManager: Force finishing activity katyloughrey5055.myapplication/.QuestionsOnChapter7
03-05 08:37:07.041 243-354/? W/ActivityManager: Force finishing activity katyloughrey5055.myapplication/.Chapter7
03-05 08:37:07.097 243-261/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12502 waiters=0 for 160ms
03-05 08:37:07.404 243-709/? I/OpenGLRenderer: Initialized EGL, version 1.4
03-05 08:37:07.434 243-709/? W/EGL_emulation: eglSurfaceAttrib not implemented
03-05 08:37:07.434 243-709/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa15b4060, error=EGL_SUCCESS
03-05 08:37:07.542 243-261/? W/ActivityManager: Activity pause timeout for ActivityRecord{51ae1ae u0 katyloughrey5055.myapplication/.QuestionsOnChapter7 t550 f}
03-05 08:37:15.843 243-261/? W/ActivityManager: Launch timeout has expired, giving up wake lock!
03-05 08:37:17.097 243-261/? W/ActivityManager: Activity destroy timeout for ActivityRecord{4286281 u0 katyloughrey5055.myapplication/.Chapter7 t550 f}
03-05 08:37:25.986 243-261/? W/ActivityManager: Activity destroy timeout for ActivityRecord{51ae1ae u0 katyloughrey5055.myapplication/.QuestionsOnChapter7 t550 f}
03-05 08:38:02.063 1921-1921/? I/Process: Sending signal. PID: 1921 SIG: 9
03-05 08:38:02.139 243-709/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa0a93c90
03-05 08:38:02.146 243-709/? D/OpenGLRenderer: endAllStagingAnimators on 0xa11f2c00 (RippleDrawable) with handle 0x9e2fec10
03-05 08:38:02.249 243-715/? D/GraphicsStats: Buffer count: 3
03-05 08:38:02.251 243-715/? I/WindowState: WIN DEATH: Window{31d21d1 u0 katyloughrey5055.myapplication/katyloughrey5055.myapplication.StudentPage}
03-05 08:38:02.369 243-548/? I/ActivityManager: Process katyloughrey5055.myapplication (pid 1921) has died
03-05 08:38:02.425 243-269/? W/AppOps: Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0
03-05 08:38:02.742 243-548/? I/ActivityManager: Start proc 2023:katyloughrey5055.myapplication/u0a61 for activity katyloughrey5055.myapplication/.StudentPage
03-05 08:38:02.820 2023-2023/? I/art: Not late-enabling -Xcheck:jni (already on)
03-05 08:38:02.821 2023-2023/? I/art: Late-enabling JIT
03-05 08:38:02.973 2023-2023/? I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
03-05 08:38:03.497 2023-2023/? W/System: ClassLoader referenced unknown path: /data/app/katyloughrey5055.myapplication-1/lib/arm
03-05 08:38:04.120 59-275/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property

最佳答案

您要么尝试使用错误的 ID 获取 Back5,然后分配一个 OnClickListener,要么您在获取按钮之前分配 OnClickListener从 View 。

关于android - 当我加载模拟器时它崩溃并说 "Unfortunately ' myapp' 已停止工作”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35812350/

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