0
在我的應用程序中,我給用戶otion使用action_send意圖共享。 在上傳到Facebook期間我的應用程序崩潰,但照片上傳成功。 這是我的代碼和logcat。你有什麼建議?android上傳照片到Facebook非法threadexception
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.fromFile(file);
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
sharingIntent.setType("image/*");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
getContext().startActivity(Intent.createChooser(sharingIntent, "Share image using"));
堆棧跟蹤:
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): FATAL EXCEPTION: main
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): java.lang.IllegalThreadStateException: Thread already started.
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at java.lang.Thread.start(Thread.java:1322)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at tomer.idunku3.GameView$1.surfaceCreated(GameView.java:103)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.view.SurfaceView.updateWindow(SurfaceView.java:532)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:206)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.view.View.dispatchWindowVisibilityChanged(View.java:3891)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:719)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:719)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:719)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.view.ViewRoot.performTraversals(ViewRoot.java:744)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.os.Handler.dispatchMessage(Handler.java:99)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.os.Looper.loop(Looper.java:123)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at android.app.ActivityThread.main(ActivityThread.java:4627)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at java.lang.reflect.Method.invokeNative(Native Method)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at java.lang.reflect.Method.invoke(Method.java:521)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-01 23:06:59.649: ERROR/AndroidRuntime(7273): at dalvik.system.NativeStart.main(Native Method)
感謝嘗試提取但是這個代碼讓我挑我的照片,但我想用份額意圖沒有崩潰 – goote
任何人有另一個想法? – goote
它說10-01 23:06:59.649:錯誤/ AndroidRuntime(7273):java.lang.IllegalThreadStateException:線程已經啓動。 然後你試圖拋出相同的線程。如果您有Asyntask做了你要知道,你必須創建爲了一個又一個不會崩潰:) –