1

我现在被这个问题困扰了一段时间。

我在程序代码中尝试的内容:

text_notice.setOnClickListener(new OnClickListener() { public void onClick(View v) {

            context = getParent();
            Log.i("", "Parent " + context.toString());

            edit_notice = new Dialog(context);
            edit_notice.setContentView(R.layout.edit_notice);
            edit_notice.setTitle(R.string.notice);

            final Button ok_button = (Button) edit_notice.findViewById(R.id.ok_button);
            final EditText notice_text = (EditText) edit_notice.findViewById(R.id.notice);

            ok_button.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    race.setNotice(notice_text.getText().toString());
                    raceDao = HelperSingleton.getInstance().getHelper().getRaceDaoException();
                    raceDao.update(race);
                    text_notice.setText(race.getNotice());
                    edit_notice.dismiss();
                } 
            });
            edit_notice.show();
            } 
    });

所以基本上向ActivityGroup添加一个窗口。

如果我走这条路,这段代码可以正常工作:RowCoachActivity --> ResultsActivity --> ShowDetailsActivity

一旦我尝试获取此路径: SettingsActivity --> RowCoachActivity --> ResultsActivity --> ShowDetailsActivity

应用程序崩溃。

有人可以帮我吗?

来自设置的调用://结束之前的 RowCoachActivity RowCoachActivity.h.sendEmptyMessage(0);

            Intent result_intent = new Intent(SettingsActivity.this, RowCoachActivity.class);
            Window window = getLocalActivityManager().startActivity("RowCoachActivity", result_intent);

这是我的日志:

E/AndroidRuntime(611): FATAL EXCEPTION: main 10-28 15:09:04.192: E/AndroidRuntime(611): android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@ 44f68e40 无效;您的活动正在运行吗?10-28 15:09:04.192: E/AndroidRuntime(611): 在 android.view.ViewRoot.setView(ViewRoot.java:505) 10-28 15:09:04.192: E/AndroidRuntime(611): 在 android. view.WindowManagerImpl.addView(WindowManagerImpl.java:177) 10-28 15:09:04.192: E/AndroidRuntime(611): 在 android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) 10-28 15:09: 04.192: E/AndroidRuntime(611): 在 android.view.Window$LocalWindowManager.addView(Window.java:424) 10-28 15:09:04.192: E/AndroidRuntime(611): 在 android.app.Dialog.show (Dialog.java:241) 10-28 15:09:04.192: E/AndroidRuntime(611): at com.

4

0 回答 0