Android 对话框不使用webview

Android 对话框不使用webview,android,android-fragments,android-webview,android-dialog,android-dialogfragment,Android,Android Fragments,Android Webview,Android Dialog,Android Dialogfragment,我的应用程序有一个webview,当用户没有输入正确的用户名和密码时,会弹出一个警告对话框,告诉他这一点 我的Webview界面类是: public class WebAppInterface extends FragmentActivity{ Context mContext; /** Instantiate the interface and set the context */ WebAppInterface(Context c) { mContext = c; } /** Sh

我的应用程序有一个webview,当用户没有输入正确的用户名和密码时,会弹出一个警告对话框,告诉他这一点

我的Webview界面类是:

public class WebAppInterface extends FragmentActivity{
Context mContext;
/** Instantiate the interface and set the context */
WebAppInterface(Context c) {
    mContext = c;
}

/** Show a toast from the web page */
@JavascriptInterface
public void showToast(String text) {
    Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
}

public void showErrorDialog(String text) {
    DialogFragment dialogFragment = new ErrorDialog();
    dialogFragment.show(getSupportFragmentManager(), "errorDialog");
    }
}
public class ErrorDialog extends DialogFragment{

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle("שגיאה");
    builder.setMessage("טקסט כלשהו");
    builder.setPositiveButton("אישור", new OnClickListener() {      
        public void onClick(DialogInterface dialog, int which) {
            dismiss();
        }
    });
    builder.setCancelable(false);
    return builder.create();
}

}
我的Dialgofragmenct课程是:

public class WebAppInterface extends FragmentActivity{
Context mContext;
/** Instantiate the interface and set the context */
WebAppInterface(Context c) {
    mContext = c;
}

/** Show a toast from the web page */
@JavascriptInterface
public void showToast(String text) {
    Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
}

public void showErrorDialog(String text) {
    DialogFragment dialogFragment = new ErrorDialog();
    dialogFragment.show(getSupportFragmentManager(), "errorDialog");
    }
}
public class ErrorDialog extends DialogFragment{

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle("שגיאה");
    builder.setMessage("טקסט כלשהו");
    builder.setPositiveButton("אישור", new OnClickListener() {      
        public void onClick(DialogInterface dialog, int which) {
            dismiss();
        }
    });
    builder.setCancelable(false);
    return builder.create();
}

}
当我在eclipse上运行调试器时,接口中的方法batherRorDialog()起作用,但当方法结束时,应用程序会发出诅咒,并且它根本不会显示警报对话框


请帮忙

如果@JavascriptInterface是可从webview的JavaScript访问的方法,则它也应该具有@JavascriptInterface。您没有告诉我们什么是rerror打印logcat。

我添加了,但仍然不起作用,是不是Web界面上下文无法传递到dialogFragment?您还有什么建议吗?