1

login(View v) function is called when a button is pressed this is defined by the onClick attribute in the xml

My code Crashes somewhere inside

Please not I have double checked -App id -Hash Key

Also something strange happens when I add com.facebook.LoginActivity inside manifest my entire eclipse shows a null pointer exception ( in a Dialog at the centre ) afterwards whenever I open editor for editing codes . Then I restart the eclipse

public void login(View v){
     // start Facebook Login
    Session.openActiveSession(this, true, new Session.StatusCallback() {

      // callback when session changes state
      @Override
      public void call(Session session, SessionState state, Exception exception) {
        if (session.isOpened()) {

          // make request to the /me API
          Request.newMeRequest(session, new Request.GraphUserCallback() {

            // callback after Graph API response with user object
            @Override
            public void onCompleted(GraphUser user, Response response) {
              if (user != null) {
                /*                TextView tw=(TextView) findViewById(R.id.tt1);
                  tw.setText(user.getName());
                  */

              }
            }
          }).executeAsync();
        }
      }
    });

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);
    Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}

LOG Data

08-16 03:05:43.203: E/AndroidRuntime(22094): FATAL EXCEPTION: main
08-16 03:05:43.203: E/AndroidRuntime(22094): java.lang.IllegalStateException: Could not execute method of the activity
08-16 03:05:43.203: E/AndroidRuntime(22094):    at android.view.View$1.onClick(View.java:3598)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at android.view.View.performClick(View.java:4091)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at android.view.View$PerformClick.run(View.java:17072)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at android.os.Handler.handleCallback(Handler.java:615)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at android.os.Handler.dispatchMessage(Handler.java:92)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at android.os.Looper.loop(Looper.java:153)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at android.app.ActivityThread.main(ActivityThread.java:5034)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at java.lang.reflect.Method.invokeNative(Native Method)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at java.lang.reflect.Method.invoke(Method.java:511)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at dalvik.system.NativeStart.main(Native Method)
08-16 03:05:43.203: E/AndroidRuntime(22094): Caused by: java.lang.reflect.InvocationTargetException
08-16 03:05:43.203: E/AndroidRuntime(22094):    at java.lang.reflect.Method.invokeNative(Native Method)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at java.lang.reflect.Method.invoke(Method.java:511)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at android.view.View$1.onClick(View.java:3593)
08-16 03:05:43.203: E/AndroidRuntime(22094):    ... 11 more
08-16 03:05:43.203: E/AndroidRuntime(22094): Caused by: java.lang.NoClassDefFoundError: android.support.v4.content.LocalBroadcastManager
08-16 03:05:43.203: E/AndroidRuntime(22094):    at com.facebook.Session.postActiveSessionAction(Session.java:1570)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at com.facebook.Session.setActiveSession(Session.java:977)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at com.facebook.Session.openActiveSession(Session.java:1132)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at com.facebook.Session.openActiveSession(Session.java:1017)
08-16 03:05:43.203: E/AndroidRuntime(22094):    at com.example.jokes.Joking.login(Joking.java:297)
08-16 03:05:43.203: E/AndroidRuntime(22094):    ... 14 more
Taimoor Ali
  • 129
  • 8

0 Answers0