我在处理程序和循环的问题上有问题

发布于 2025-01-28 19:13:45 字数 4315 浏览 2 评论 0原文

我的项目由两个部分和2部分组成。

  1. 在缅因州活动中记录的数据,然后按下保存按钮(存储在FirerBase中的数据)。
  2. 接下来,我们按下按钮要读取,然后打开一个带有列表的窗口,然后当您单击愚蠢的对象时,我们打开了一个带有部署描述的新窗口。

第一部分有效,第二部分没有,程序崩溃并显示以下错误:

logcat

   2022-05-12 14:52:30.530 9756-9756/com.example.t3 E/AndroidRuntime: FATAL EXCEPTION: main
        Process: com.example.t3, PID: 9756
        java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.t3/com.example.t3.ReadActivity}: android.view.InflateException: Binary XML file line #19 in com.example.t3:layout/activity_read: addView(View, LayoutParams) is not supported in AdapterView
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:223)
            at android.app.ActivityThread.main(ActivityThread.java:7656)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
         Caused by: android.view.InflateException: Binary XML file line #19 in com.example.t3:layout/activity_read: addView(View, LayoutParams) is not supported in AdapterView
         Caused by: java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
            at android.widget.AdapterView.addView(AdapterView.java:515)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:1125)
            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
            at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699)
            at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
            at com.example.t3.ReadActivity.onCreate(ReadActivity.java:33)
            at android.app.Activity.performCreate(Activity.java:8000)
            at android.app.Activity.performCreate(Activity.java:7984)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:223)
            at android.app.ActivityThread.main(ActivityThread.java:7656)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
  @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_read);
    init();
    getDataFromDb();
    setOnClickItem();
}

My project consists of two parts 1 and 2.

  1. in Maine Activity recorded data, then pressed to the Save button (data stored in Firerbase).
  2. Next, we pressed the button to read, and we opened a window with a list, then when you click on a dumb object, we opened a new window with a deployed description.

The first part works, and the second doesn't, the program crashes and shows the following error:

LogCat

   2022-05-12 14:52:30.530 9756-9756/com.example.t3 E/AndroidRuntime: FATAL EXCEPTION: main
        Process: com.example.t3, PID: 9756
        java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.t3/com.example.t3.ReadActivity}: android.view.InflateException: Binary XML file line #19 in com.example.t3:layout/activity_read: addView(View, LayoutParams) is not supported in AdapterView
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:223)
            at android.app.ActivityThread.main(ActivityThread.java:7656)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
         Caused by: android.view.InflateException: Binary XML file line #19 in com.example.t3:layout/activity_read: addView(View, LayoutParams) is not supported in AdapterView
         Caused by: java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
            at android.widget.AdapterView.addView(AdapterView.java:515)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:1125)
            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
            at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699)
            at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
            at com.example.t3.ReadActivity.onCreate(ReadActivity.java:33)
            at android.app.Activity.performCreate(Activity.java:8000)
            at android.app.Activity.performCreate(Activity.java:7984)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:223)
            at android.app.ActivityThread.main(ActivityThread.java:7656)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
  @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_read);
    init();
    getDataFromDb();
    setOnClickItem();
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文