sendUserActionEvent()在点击按钮后mView== null

23

我已经查看了这个链接,但是它提到长按。但我在自定义对话框的按钮上单击后遇到了这个问题。 我在这里粘贴了我的代码。有没有人能帮我避免这个错误。

  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>


1
嗨,我也遇到了同样的问题,你解决了吗... - kumar Sudheer
@kumarsu:还没有。但是我在Note 8上也有它。 - akshay
你代码中的mView是什么?我在附加的示例中没有看到它。 - Ilya Gazman
可能是sendUserActionEvent() is null的重复问题。 - Manuel Allenspach
请查看此链接中的答案,它可能能够解决您的问题:<br> https://dev59.com/Hn7aa4cB1Zd3GeqPsqGc#40619021 - A.J
2个回答

20

这不是与你的代码相关的问题,而是与S4安卓版本相关的问题。同样的问题已经在stackoverflow上提出:sendUserActionEvent() is null

所以,只需忽略它;)


1
你有关于这个的参考资料吗? - akshay
1
我的三星Galaxy S4:GT-I9505,Android版本为4.3,版本号为I9505XXUEMKF,内核版本为3.4.0-2082040。 - Seynorth
我询问了您在评论中提到的三星Android层。 - akshay
是的,它的名字叫TouchWiz,版本在我的评论中提到:版本4.3-I9505XXUEMKF。 - Seynorth
这个问题也发生在Galaxy S3上,使用4.3-JSS15J.I9300XXUGMK6固件。 - Igor Čordaš
显示剩余3条评论

1
在我的情况下,我同时使用了所有这些意图标志来启动活动:
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 标志设置为 true,问题就解决了:

intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接