gpt4 book ai didi

android - Google+ 中的 ActivityNotFoundException

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:23:48 27 4
gpt4 key购买 nike

我的应用程序想在 Google Plus 上分享图片我已经阅读了关于 Google Plus API 显示我们可以使用 PlusShare.Builder 发布媒体文件.而且我还在 stackoverflow 中进行了搜索,但没有得到任何正确的答案。我试过这些代码是:

case R.id.Share:
if (mPlusClient.isConnected()) {
Intent shareIntent = new PlusShare.Builder(this,mPlusClient)
.setType("image/*")
.setText("Risk Score")
.addStream(Uri.fromFile(new File(Path)))
.getIntent();
startActivityForResult(shareIntent, REQ_START_SHARE);
}

break;

  case R.id.Share:

Intent shareIntent = ShareCompat.IntentBuilder.from(PlusActivity.this)
.setText("This site has lots of great information about Android! http://www.android.com")
.setType("image/*").addStream(Uri.fromFile(new File(Path)))
.getIntent().setPackage("com.google.android.apps.plus");
startActivityForResult(shareIntent, REQ_START_SHARE);
break;

 case R.id.Share:

Intent shareIntent = new PlusShare.Builder(this,mPlusClient)
.setType("image/*")
.setText("Risk Score")
.addStream(Uri.fromFile(new File(Path)))
.getIntent();
startActivityForResult(shareIntent, REQ_START_SHARE);

break;

每次我遇到同样的问题。

12-05 12:19:57.316: E/AndroidRuntime(4688): FATAL EXCEPTION: main
12-05 12:19:57.316: E/AndroidRuntime(4688): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND typ=image/* flg=0x80000 pkg=com.google.android.apps.plus (has extras) }
12-05 12:19:57.316: E/AndroidRuntime(4688): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1518)
12-05 12:19:57.316: E/AndroidRuntime(4688): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1390)
12-05 12:19:57.316: E/AndroidRuntime(4688): at android.app.Activity.startActivityForResult(Activity.java:3204)
12-05 12:19:57.316: E/AndroidRuntime(4688): at com.winit.android.riskfactor.PlusActivity.onClick(PlusActivity.java:133)
12-05 12:19:57.316: E/AndroidRuntime(4688): at android.view.View.performClick(View.java:3517)
12-05 12:19:57.316: E/AndroidRuntime(4688): at android.view.View$PerformClick.run(View.java:14155)
12-05 12:19:57.316: E/AndroidRuntime(4688): at android.os.Handler.handleCallback(Handler.java:605)
12-05 12:19:57.316: E/AndroidRuntime(4688): at android.os.Handler.dispatchMessage(Handler.java:92)
12-05 12:19:57.316: E/AndroidRuntime(4688): at android.os.Looper.loop(Looper.java:154)
12-05 12:19:57.316: E/AndroidRuntime(4688): at android.app.ActivityThread.main(ActivityThread.java:4624)
12-05 12:19:57.316: E/AndroidRuntime(4688): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 12:19:57.316: E/AndroidRuntime(4688): at java.lang.reflect.Method.invoke(Method.java:511)
12-05 12:19:57.316: E/AndroidRuntime(4688): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
12-05 12:19:57.316: E/AndroidRuntime(4688): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
12-05 12:19:57.316: E/AndroidRuntime(4688): at dalvik.system.NativeStart.main(Native Method)

我也读过这些问题

sending-json-data-to-google-plus

android-google-plush-intregation-in-my-android-app-gives-android-content-activit

sending-json-data-to-google-plus

failing-to-share-on-google-with-android

no-activity-found-to-handle-intent-causes-fc

最佳答案

Google+ 没有可供一般开发人员使用的独立写入 API - 通过应用程序发布到 Google+ 的唯一方法是打开 Google+ 应用程序(最好使用 PlusShare.Builder 返回的 Intent)因此,如果 Google plus 不存在,那么它将给出 ActivityNotFoundException。

关于android - Google+ 中的 ActivityNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20393419/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com