java.lang.NoSuchMethodError上Activity.showDialog(INT,捆绑)?NoSuchMethodError、lang、java、INT

由网友(很贱又欠揍的六字)分享简介:下面是LogCat中所说的:Here is what LogCat says: 01-21 17:20:06.057: ERROR/AndroidRuntime(27463): java.lang.NoSuchMethodError: com.mohit.geo2do.activities.TasksList.s...

下面是LogCat中所说的:

Here is what LogCat says:

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)

我在这句话得到一个错误:

I get an error at this phrase:

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

我有一个上prepareDialog 方法:

@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;
    }
}

这可能是什么问题?

What could be the problem?

推荐答案

一般来说,这意味着你对编译的类,你就不要运行类的不同版本。您所呼叫的方法是你的编译器访问,但不可用于在运行时JVM。

Generally that means the class you compiled against and the class you're running against are different versions. The method you are calling was accessible to your compiler but is not available to the JVM at runtime.

阅读全文

相关推荐

最新文章