【问题标题】:sendUserActionEvent() mView== null after clicking on button点击按钮后 sendUserActionEvent() mView== null
【发布时间】:2013-12-08 06:29:27
【问题描述】:

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

  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>

【问题讨论】:

  • 您好,我也遇到了同样的问题,请问您解决了吗...
  • @kumarsu:还没有。但我也在注释 8 上得到了它。
  • 代码中的 mView 是什么。我在随附的示例中没有看到它
  • 在此链接中查看我的答案,它可能会解决您的问题:
    stackoverflow.com/questions/23016155/…

标签: android dialog customdialog


【解决方案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 标志就解决了问题:

intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

【讨论】:

    【解决方案2】:

    这不是与您的代码有关的问题,而是与 S4 android 版本有关。 在 stackoverflow 上也提出了同样的问题:sendUserActionEvent() is null

    所以,请忽略它;)

    【讨论】:

    • 是的,我也检查了该代码,我不仅得到了这个 ons4,而且还在 note8 上得到了这个。
    • 我认为这是由于三星 android 层在 S4 和 note8 之间应该是相同的。
    • 有没有相同的参考资料
    • 只是我的三星 Galaxy S4:GT-I9505,Android 版本 4.3,版本 I9505XXUEMKF,内核版本 3.4.0-2082040
    • 我问过你在评论中提到的三星安卓层。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多