当前位置: 首页 > 知识库问答 >
问题:

单击按钮后,sendUserActionEvent()mView==null

陶睿
2023-03-14

我已经检查了这个链接,但它提到了长点击。但是我在点击自定义对话框的按钮后面临这个问题。我已经把我的代码贴在这里了。有人能帮我避免这个错误吗?

  ibtnCancel.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.w("DemoDvicetracker", etConfirmPassword
                .getText().toString());
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(
                etConfirmPassword.getWindowToken(), 0);

            passwordPopup.dismiss();

        }
        });
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:id="@+id/rel"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:background="@drawable/popup_bg" >

<TextView
    android:id="@+id/txt_enter_pwd"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:text="@string/enter_pwd"
    android:textSize="24sp"
    android:textColor="@android:color/black" />

<EditText
    android:id="@+id/et_password"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/txt_enter_pwd"
    android:hint="@string/pwd" 
    android:background="@drawable/popup_textfeild"
    android:layout_marginTop="30dp"
    android:layout_marginLeft="15dp"
    android:layout_marginRight="15dp"
    android:inputType="textPassword"/>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="60dip"
    android:layout_alignParentBottom="true"
    android:layout_below="@+id/et_password"
    android:gravity="bottom"
    android:orientation="horizontal" >

    <ImageButton
        android:id="@+id/ibtn_dialog_cancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@drawable/popup_cancel_selector" 
        android:contentDescription="@string/cancel"/>

    <ImageButton
        android:id="@+id/ibtn_dialog_submit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="0dp"
        android:layout_weight="1"
        android:background="@drawable/popup_submit_selector" 
        android:contentDescription="@string/submit"/>
</LinearLayout>

共有2个答案

苏弘盛
2023-03-14

在我的案例中,我将所有这些意图标志一起用于意图活动:

intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

只留下clear_top旗就解决了问题:

intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
姬飞昂
2023-03-14

这与您的代码无关,但与S4 android版本有关。对stackoverflow也提出了同样的问题:sendUserActionEvent()为null

所以,忽略它;)

 类似资料:
  • 我试图在应用程序中使用相机捕获图像后预览它,我确信路径不是空的,但我在以下代码行中收到了这个错误并且没有图像视图。注意:我在另一个设备上测试了代码(不是三星),它可以工作。

  • 编辑:底部的解决方案 这是一个跳棋游戏。单击一个按钮后,它等待单击第二个按钮与之交换。然而,有时你可能不想移动那个按钮,但一旦你点击了它,就没有回头路了,因为我无法禁用它。 在这里的其他帖子中,我看到人们使用 这只是使它在第一次单击后不可见。 这什么都干不了。 这也没什么用。编辑:所有这些方法都用true和false进行了尝试。 私有无效交换(){ 但你也需要 这样它就重新启用了它,或者其他什么,

  • 我需要一些android编程的帮助。所以onbutton click我在icite方法中调用。基本上,当单击按钮时,所有文本框文本都将转换为一个新变量上的字符串。之后,我将所有变量组合成一个名为total的字符串。然后将标签textView10的文本更改为字符串total。然而,它只是崩溃了我的应用程序。你知道我可能做错了什么吗?我的猫: 代码

  • 我正试图抓取一个页面,获取一盘国际象棋的移动列表,该列表位于右侧菜单的“移动”选项卡下。 在浏览器中手动单击“移动”选项卡时,我可以通过 哪个(正确地)返回 当尝试通过单击按钮时,使用 似乎什么都没有发生,我不知道如何进行故障排除。 如何通过模拟单击(活动事件侦听器)切换到“移动”选项卡? 额外提示:是否可以使用rvest软件包?

  • 问题内容: 我正在尝试在www.meetme.com上发送消息,但不知道该怎么做。我可以在评论区域中键入消息,但是单击“发送”按钮不会执行任何操作。我究竟做错了什么?当我登录并按登录按钮时,页面确实发生了变化,一切都很好。有人有任何想法或线索吗? 问题答案: 如果不了解正在访问的网页,就无法在禁用JavaScript的情况下执行AJAX请求。如果更改未成功,则必须继续进行调试,但请确保已启用Jav

  • 在我的程序中,它将单击浏览器中的一个按钮,并且在该页面中,应该会出现另一个按钮。出现该按钮后,我的程序将立即运行下一个操作来单击下一个按钮。我目前收到此错误: ElementNotVisibleException:消息:元素不可见 因此,我假设我正在调用该操作,以便在该按钮出现之前单击下一个按钮。我的问题是,我该怎么做才能让我的程序等到我可以点击按钮,再点击按钮? 这就是我的程序底部的代码的样子。