当前一个片段中的对话框代码时出现null异常,当对话框关闭应用程序崩溃时,Dialog在下一个片段中打开

时间:2014-03-28 10:49:09

标签: android android-fragments android-fragmentactivity android-dialog

每当我进入下一个片段并单击共享按钮对话框构建器打开对话框窗口时,

share_button设置在顶栏中,当对话框窗口关闭时,我回来任何片段应用程序崩溃

这里“share_dialog”是LinearLayout “CircleMenuScreen.this”是当前的FragmentActivity

aq.id(R.id.share_button).textColor(Utils.getHexColor(themeObj.topBottomBarHomeScreenButton.TopBottomBarBtnIconColor)).clicked(new OnClickListener() {

@Override
public void onClick(View v) {
LayoutInflater inflater = getLayoutInflater();
View dialoglayout = inflater.inflate(R.layout.share_dialog, null);
AlertDialog.Builder builder = new AlertDialog.Builder(CircleMenuScreen.this);
aq = new AQuery(dialoglayout);
aq.id(R.id.facebook).typeface(TypeFaces.get(getApplicationContext(),Constants.TYPE_FACE_PAT;
aq.id(R.id.twitter).typeface(
        TypeFaces.get(getApplicationContext(),
                Constants.TYPE_FACE_PATH));
aq.id(R.id.sms).typeface(
        TypeFaces.get(getApplicationContext(),
                Constants.TYPE_FACE_PATH));
aq.id(R.id.email).typeface(
        TypeFaces.get(getApplicationContext(),
                Constants.TYPE_FACE_PATH));
builder.setView(dialoglayout);
builder.show();

错误

03-28 15:43:01.949: E/AndroidRuntime(16586): java.lang.NullPointerException
03-28 15:43:01.949: E/AndroidRuntime(16586):    at com.zasda.zasda.startscreen.CircleMenuScreen.onBackPressed(CircleMenuScreen.java:412)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.app.Activity.onKeyUp(Activity.java:2193)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.KeyEvent.dispatch(KeyEvent.java:2664)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.app.Activity.dispatchKeyEvent(Activity.java:2423)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1962)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3852)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3826)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3449)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3418)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3525)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3426)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3582)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3449)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3418)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3426)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3449)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3418)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3558)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:3718)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2010)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1704)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1695)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:1987)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.os.MessageQueue.nativePollOnce(Native Method)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.os.MessageQueue.next(MessageQueue.java:138)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.os.Looper.loop(Looper.java:123)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at android.app.ActivityThread.main(ActivityThread.java:5017)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at java.lang.reflect.Method.invokeNative(Native Method)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at java.lang.reflect.Method.invoke(Method.java:515)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-28 15:43:01.949: E/AndroidRuntime(16586):    at dalvik.system.NativeStart.main(Native Method)

0 个答案:

没有答案