Facebook android exception...

I/BubHole ( 9325):
V/BubHole ( 9325): JNI: fb_post() called
I/ActivityThread( 9466): Pub com.google.android.gallery3d.GooglePhotoProvider: com.google.android.picasasync.PicasaContentProvider
W/dalvikvm( 9325): threadid=19: thread exiting with uncaught exception (group=0x40dc2300)
E/AndroidRuntime( 9325): FATAL EXCEPTION: GLThread 3221
E/AndroidRuntime( 9325): java.lang.RuntimeException: Can’t create handler inside thread that has not called Looper.prepare()
E/AndroidRuntime( 9325): at android.os.Handler.(Handler.java:121)
E/AndroidRuntime( 9325): at android.app.Dialog.(Dialog.java:107)
E/AndroidRuntime( 9325): at android.app.Dialog.(Dialog.java:147)
E/AndroidRuntime( 9325): at com.facebook.android.FbDialog.(FbDialog.java:62)
E/AndroidRuntime( 9325): at com.facebook.android.Facebook.dialog(Facebook.java:840)
E/AndroidRuntime( 9325): at com.facebook.android.Facebook.dialog(Facebook.java:797)
E/AndroidRuntime( 9325): at com.smartmind.BubbleBox.BubbleBox.fb_post(BubbleBox.java:127)
E/AndroidRuntime( 9325): at org.cocos2dx.lib.Cocos2dxRenderer.nativeTouchesEnd(Native Method)
E/AndroidRuntime( 9325): at org.cocos2dx.lib.Cocos2dxRenderer.handleActionUp(Cocos2dxRenderer.java:120)
E/AndroidRuntime( 9325): at org.cocos2dx.lib.Cocos2dxGLSurfaceView$8.run(Cocos2dxGLSurfaceView.java:245)
E/AndroidRuntime( 9325): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
E/AndroidRuntime( 9325): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
W/ActivityManager( 250): Force finishing activity com.smartmind.BubbleBox/.BubbleBox

Hi, do you have any idea for this exception? :frowning:
I have tried to insert a post to Facebook wall!

help please!

Thanks

Stefano

public void fb_post()
{
Log.v(TAG, “JNI: fb_post() called”);

authenticatedFacebook.dialog(BubbleBox.this, “stream.publish”, new FacebookPostListener());
}

Check this post:

http://www.cocos2d-x.org/boards/6/topics/12492

There is the solution at bottom.

Thanks!
I have found my problem. The error was because I don’t have called the method inside the Main thread!
this is the patch:

activity.runOnUiThread(new Runnable() {
public void run() {

authenticatedFacebook.dialog(BubbleBox.this, “stream.publish”, parameters, new FacebookPostListener());
}

Stefano

Pipero Man wrote:

Check this post:
>
http://www.cocos2d-x.org/boards/6/topics/12492
>
There is the solution at bottom.

this is my solution to create a post:

public void fb_post()
{
Log.v(TAG, “JNI: fb_post() called”);

BubbleBox.this.runOnUiThread(new Runnable() {
public void run() {

try {

JSONObject attachment = new JSONObject();
attachment.put(“message”, …);
attachment.put(“name”, …);
attachment.put(“href”, …);
attachment.put(“description”, …);

JSONObject media = new JSONObject();
media.put(“type”, …);
media.put(“src”, …);
media.put(“href”, …);
attachment.put(“media”, new JSONArray().put(media));

JSONObject properties = new JSONObject();

JSONObject prop1 = new JSONObject();
prop1.put(“text”, …);
prop1.put(“href”, …);
properties.put(… , prop1);

JSONObject prop2 = new JSONObject();
prop2.put(“text”, …);
prop2.put(“href”, …);
properties.put(…, prop2);

attachment.put(“properties”, properties);

Log.i(TAG, “——-POST FACEBOOK———”);
Log.i(TAG, attachment.toString());
Log.i(TAG, “—————————-”);

Bundle parameters = new Bundle();
parameters.putString(“attachment”, attachment.toString());

authenticatedFacebook.dialog(BubbleBox.this, “stream.publish”, parameters, new FacebookPostListener());
}
catch (JSONException e)
{
Log.e(“FACEBOOK”, e.getLocalizedMessage(), e);
}
}
});
}

Stefano

Stefano Campodall’Orto wrote:

Thanks!
I have found my problem. The error was because I don’t have called the method inside the Main thread!
this is the patch:
>
activity.runOnUiThread(new Runnable() {
public void run() {

authenticatedFacebook.dialog(BubbleBox.this, “stream.publish”, parameters, new FacebookPostListener());
}
>
>
Stefano
>
Pipero Man wrote:
> Check this post:
>
> http://www.cocos2d-x.org/boards/6/topics/12492
>
> There is the solution at bottom.