在我在编辑文本中输入值后,我在弹出窗口中使用编辑文本,它显示一些错误的令牌错误。有人知道请帮我解决这个问题。
我的弹出窗口编码。
inflater1 = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
popupView = inflater1.inflate(R.layout.image_pop_up, null, true);
pw = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
pw.setFocusable(true)
EditText name = (EditText)popupView.findViewById(R.id.edittext1);
pw.showAtLocation(activity.findViewById(R.id.order_page_xml), Gravity.CENTER, 0, 15);
我的日志猫错误是
05-11 17:44:05.381: E/AndroidRuntime(1558): android.view.WindowManager$BadTokenException: Unable to add window -- token android.view.ViewRootImpl$W@4169cf30 is not valid; is your activity running?
05-11 17:44:05.381: E/AndroidRuntime(1558): at android.view.ViewRootImpl.setView(ViewRootImpl.java:513)
05-11 17:44:05.381: E/AndroidRuntime(1558): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:301)