enter code here
ListViewのonItemClickイベントでAlertDialogを作成していますが、エラーが発生します
Failed to handle callback; interface not implemented,
callback:android.widget.AbsListView$1@41b28670
そして私のコードはここにあります:
public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
alertDialog = new AlertDialog.Builder(RemoteDeviceActivity.this).create(); //alertDialog is global AlertDialog variable
alertDialog.setTitle("Version Mismatch");
alertDialog.setMessage("My Message");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog.dismiss();
}
});
alertDialog.show();
}
これは私のlogcatです:
07-05 14:48:44.402: E/Handler(6217): Failed to handle callback; interface not implemented, callback:android.widget.AbsListView$1@41b79c38
07-05 14:48:44.402: E/Handler(6217):
android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@41a668d0 is not valid;
is your activity running?
07-05 14:48:44.402: E/Handler(6217): at android.view.ViewRootImpl.setView(ViewRootImpl.java:570)
07-05 14:48:44.402: E/Handler(6217): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:406)
07-05 14:48:44.402: E/Handler(6217): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:320)
07-05 14:48:44.402: E/Handler(6217): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:152)
07-05 14:48:44.402: E/Handler(6217): at android.view.Window$LocalWindowManager.addView(Window.java:557)
07-05 14:48:44.402: E/Handler(6217): at android.app.Dialog.show(Dialog.java:301)
07-05 14:48:44.402: E/Handler(6217): at android.app.AlertDialog$Builder.show(AlertDialog.java:932)
07-05 14:48:44.402: E/Handler(6217): at com.np.obelix.RemoteDeviceActivity.onItemClick(RemoteDeviceActivity.java:208)
07-05 14:48:44.402: E/Handler(6217): at android.widget.AdapterView.performItemClick(AdapterView.java:292)
07-05 14:48:44.402: E/Handler(6217): at android.widget.AbsListView.performItemClick(AbsListView.java:1099)
07-05 14:48:44.402: E/Handler(6217): at android.widget.ListView.performItemClick(ListView.java:4758)
07-05 14:48:44.402: E/Handler(6217): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2556)
07-05 14:48:44.402: E/Handler(6217): at android.widget.AbsListView$1.run(AbsListView.java:3223)
07-05 14:48:44.402: E/Handler(6217): at android.os.Handler.handleCallback(Handler.java:607)
07-05 14:48:44.402: E/Handler(6217): at android.os.Handler.dispatchMessage(Handler.java:92)
07-05 14:48:44.402: E/Handler(6217): at android.os.Looper.loop(Looper.java:154)
07-05 14:48:44.402: E/Handler(6217): at android.app.ActivityThread.main(ActivityThread.java:4974)
07-05 14:48:44.402: E/Handler(6217): at java.lang.reflect.Method.invokeNative(Native Method)
07-05 14:48:44.402: E/Handler(6217): at java.lang.reflect.Method.invoke(Method.java:511)
07-05 14:48:44.402: E/Handler(6217): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-05 14:48:44.402: E/Handler(6217): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-05 14:48:44.402: E/Handler(6217): at dalvik.system.NativeStart.main(Native Method)