0

Lets say I sign in from class Login, using gdxFacebook = GDXFacebookSystem.install(config); and gdxFacebook.signIn. I can then call GDXFacebookGraphRequest request = new GDXFacebookGraphRequest().setNode("me").useCurrentAccessToken(); without any issues.

However, when I try to use GDXFacebookGraphRequest request = new GDXFacebookGraphRequest().setNode("me/invitable_friends").useCurrentAccessToken(); from class FriendList I get an error. I've tried with and without installing facebook again. Do I need to pass gdxFacebook from class Login in order to use the access token? or is there a better way?

Error message:

E/AndroidRuntime: FATAL EXCEPTION: GLThread 69865
              Process: com.scene2d.tut.android, PID: 16786
              java.lang.NullPointerException: Attempt to invoke virtual method 'void de.tomgrill.gdxfacebook.core.GDXFacebook.newGraphRequest(de.tomgrill.gdxfacebook.core.GDXFacebookGraphRequest, de.tomgrill.gdxfacebook.core.GDXFacebookCallback)' on a null object reference
Green_qaue
  • 3,561
  • 11
  • 47
  • 89
  • You need the gdxFacebook returned from GDXFacebookSystem.install(config); for each request. – TomGrill Games Jul 02 '16 at 16:38
  • @TomGrill Games So I need to pass the gdxFacebook from my login-class to any other class that needs it? Or can I just run the install again? When I try just installing it again (not passing it from login-class) I get `Graph Reqest: Error. Something went wrong with the access token.` – Green_qaue Jul 02 '16 at 17:19
  • Either pass the variable or use GDXFacebookSystem.getFacebook(); after you have installed it. – TomGrill Games Jul 02 '16 at 17:26
  • Ah, didnt know that existed. Awesome! – Green_qaue Jul 02 '16 at 17:31
  • I added it to the Wiki for later vistors. – TomGrill Games Jul 02 '16 at 17:31
  • Yeah I need to update :) Dont have it. Such an awesome extension btw! – Green_qaue Jul 02 '16 at 17:33
  • @TomGrillGames Is the new version using Facebook SDK 4.+? Causing this issue for me: http://stackoverflow.com/questions/35963144/no-resource-found-that-matches-the-given-name-at-cardbackgroundcolor-with-val – Green_qaue Jul 02 '16 at 18:17

0 Answers0