gpt4 book ai didi

Activity.showDialog(int,Bundle)上的java.lang.NoSuchMethodError?

转载 作者:太空狗 更新时间:2023-10-29 15:57:35 26 4
gpt4 key购买 nike

这是 LogCat 所说的:

01-21 17:20:06.057: ERROR/AndroidRuntime(27463): java.lang.NoSuchMethodError: com.mohit.geo2do.activities.TasksList.showDialog
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.mohit.geo2do.activities.TasksList.onContextItemSelected(TasksList.java:190)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.app.Activity.onMenuItemSelected(Activity.java:2183)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.policy.impl.PhoneWindow$ContextMenuCallback.onMenuItemSelected(PhoneWindow.java:2785)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:140)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:129)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:898)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.widget.AdapterView.performItemClick(AdapterView.java:301)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.widget.ListView.performItemClick(ListView.java:3626)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.widget.AbsListView$PerformClick.run(AbsListView.java:3600)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.os.Handler.handleCallback(Handler.java:587)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.os.Handler.dispatchMessage(Handler.java:92)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.os.Looper.loop(Looper.java:123)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.app.ActivityThread.main(ActivityThread.java:4363)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at java.lang.reflect.Method.invokeNative(Native Method)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at java.lang.reflect.Method.invoke(Method.java:521)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at dalvik.system.NativeStart.main(Native Method)

我在这个短语处出错:

Bundle args = new Bundle();
args.putLong("id", ...); //Some arbitrary value
showDialog(DELETE_DIALOG, args);

我有一个onPrepareDialog 方法:

@Override
protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
switch (id) {
case DELETE_DIALOG:
AlertDialog log = (AlertDialog) dialog;
final Bundle bundle = args;
log.setButton(DialogInterface.BUTTON_POSITIVE, "Ok", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
long id = bundle.getLong("id");

getContentResolver().delete(Tasks.CONTENT_URI, Tasks._ID + "=" + id, null);
adapter.notifyDataSetChanged();
}
});
break;
default:
break;
}
}

可能是什么问题?

最佳答案

通常这意味着您编译的类和您运行的类是不同的版本。您正在调用的方法可由您的编译器访问,但在运行时不可用于 JVM。

关于Activity.showDialog(int,Bundle)上的java.lang.NoSuchMethodError?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4764506/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com