Note that there are some explanatory texts on larger screens.

plurals
  1. POPost message with photo in facebook with android and got error: An unknown error has occurred
    primarykey
    data
    text
    <p>I am trying to post a photo and a message to a user's wall. My code is posted below.</p> <p>When I post just the message, it is successfully posted. But when I post message with a picture I get an Unknown error.</p> <p>When user press on Button than below code will be execute:</p> <pre><code> mFacebook.authorize(MainActivity.this, new String[] { "user_about_me", "email","publish_stream", "read_stream", "offline_access" }, new TestLoginListener()); public class TestLoginListener implements DialogListener { public void onComplete(Bundle values) { try { { Bundle parameters = new Bundle(); parameters.putString("message", "Test\n"); String path=Environment.getExternalStorageDirectory()+"/Diegodeals/"; if(!new File(path).exists()) new File(path).mkdirs(); File photo = new File(path, "diegodeals.jpg"); if(photo!=null){ System.out.println(Uri.fromFile(photo).toString()); parameters.putString("picture", Uri.fromFile(photo).toString()); } String response = mFacebook.request("me/feed", parameters, "POST"); JSONObject json; try { json = Util.parseJson(response); if (!json.isNull("id")) { Toast.makeText(MainActivity.this, "SUCCESSED ssssssss", Toast.LENGTH_LONG).show(); } else { Toast.makeText(MainActivity.this, "fail", Toast.LENGTH_LONG).show(); } } catch (FacebookError e) { e.printStackTrace(); } new FBLongOpertaion().execute(""); } /*String resID = mFacebook.request("me"); JSONObject objId = Util.parseJson(response);*/ } catch (Exception e) { e.printStackTrace(); } } public void onCancel() { } public void onError(DialogError e) { e.printStackTrace(); } public void onFacebookError(FacebookError e) { e.printStackTrace(); } } </code></pre> <p>I got an error like <em>UnKnown Error Detected</em>. My Logcat value is</p> <pre><code> 09-06 10:50:42.210: W/System.err(352): com.facebook.android.FacebookError: An unknown error has occurred. 09-06 10:50:42.240: W/System.err(352): at com.facebook.android.Util.parseJson(Util.java:279) 09-06 10:50:42.240: W/System.err(352): at com.eheuristics.android.diegodeals.MainActivity$TestLoginListener.onComplete(MainActivity.java:146) 09-06 10:50:42.240: W/System.err(352): at com.facebook.android.Facebook$1.onComplete(Facebook.java:354) 09-06 10:50:42.240: W/System.err(352): at com.facebook.android.FbDialog$FbWebViewClient.shouldOverrideUrlLoading(FbDialog.java:145) 09-06 10:50:42.240: W/System.err(352): at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:216) 9-06 10:50:42.240: W/System.err(352): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:323) 09-06 10:50:42.240: W/System.err(352): at android.os.Handler.dispatchMessage(Handler.java:99) 09-06 10:50:42.240: W/System.err(352): at android.os.Looper.loop(Looper.java:130) 09-06 10:50:42.240: W/System.err(352): at android.app.ActivityThread.main(ActivityThread.java:3683) 09-06 10:50:42.251: W/System.err(352): at java.lang.reflect.Method.invokeNative(Native Method) 09-06 10:50:42.251: W/System.err(352): at java.lang.reflect.Method.invoke(Method.java:507) 09-06 10:50:42.251: W/System.err(352): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 09-06 10:50:42.251: W/System.err(352): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) </code></pre> <p>09-06 10:50:42.251: W/System.err(352): at dalvik.system.NativeStart.main(Native Method)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload