0

アプリのボタンをクリックすると、次の Logcat 情報が表示されます。

06-19 11:24:45.308: E/AndroidRuntime(11498): FATAL EXCEPTION: main
06-19 11:24:45.308: E/AndroidRuntime(11498): java.lang.IllegalStateException: Could not execute method of the activity
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.view.View$1.onClick(View.java:3674)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.view.View.performClick(View.java:4198)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.view.View$PerformClick.run(View.java:17164)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.os.Handler.handleCallback(Handler.java:615)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.os.Handler.dispatchMessage(Handler.java:92)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.os.Looper.loop(Looper.java:137)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.app.ActivityThread.main(ActivityThread.java:4918)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at java.lang.reflect.Method.invokeNative(Native Method)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at java.lang.reflect.Method.invoke(Method.java:511)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at dalvik.system.NativeStart.main(Native Method)
06-19 11:24:45.308: E/AndroidRuntime(11498): Caused by: java.lang.reflect.InvocationTargetException
06-19 11:24:45.308: E/AndroidRuntime(11498):    at java.lang.reflect.Method.invokeNative(Native Method)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at java.lang.reflect.Method.invoke(Method.java:511)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.view.View$1.onClick(View.java:3669)
06-19 11:24:45.308: E/AndroidRuntime(11498):    ... 11 more
06-19 11:24:45.308: E/AndroidRuntime(11498): Caused by: java.lang.NoClassDefFoundError: com.facebook.android.MainActivity$UpdateStatusListener
06-19 11:24:45.308: E/AndroidRuntime(11498):    at com.facebook.android.MainActivity.triggerDialog(MainActivity.java:55)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at com.facebook.android.MainActivity.firstClicked(MainActivity.java:36)
06-19 11:24:45.308: E/AndroidRuntime(11498):    ... 14 more

Facebook SDK for Android を使用した例に従ってクラスをセットアップする方法を次に示します。関連するメソッドと情報のみがここに表示されます。

public class MainActivity extends Activity {

    //triggered when the button is clicked
    public void firstClicked(View view)
    {
        triggerDialog();
    }

    public void triggerDialog()
    {
                //assume for the sake of this post that this string array has 4 strings
            String[] offer_details = postOffer.getDetails();
            Bundle params = new Bundle();
                params.putString("caption", getString(R.string.app_name));  //Hackbook for Android

                Utility.mFacebook.dialog(MainActivity.this, "feed", params, new UpdateStatusListener());
    }

    public class UpdateStatusListener extends BaseDialogListener {

        @Override
        public void onComplete(Bundle values) {
            Log.i("wbbug","Status post complete.");
            final String postId = values.getString("post_id");
            if (postId != null) {
                Toast toast = Toast.makeText(getApplicationContext(), "Facebook status update successful", Toast.LENGTH_LONG);
                toast.show();
            } else {
                Toast toast = Toast.makeText(getApplicationContext(), "No wall post made",
                        Toast.LENGTH_LONG);
                toast.show();
            }
        }

    }


}

これはすべて、Facebook SDK の例に直接従っており、例はこの基本的なコードで動作しています。クラス UpdateStatusListener() が見つからないのはなぜですか? ありがとう!

4

0 に答える 0