Intent share = new Intent(Intent.ACTION_SEND);
if(isVideo()){
share.setType("video/*");
} else {
share.setType("image/*");
}
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(fileName)));
Context context = getContext();
context.startActivity(Intent.createChooser(share, context.getString(R.string.share_via)));
上面的代码只是在 Galaxy S 上崩溃了。我正在研究 logcat,我唯一看到的是:
2018-10-22 15:00:30.582 1447-1514/? W/ActivityManager: Activity pause timeout for ActivityRecord{c5eef5f u0 com.app/.Activity t134}
2018-10-22 15:00:30.599 12453-12453/? W/ChooserActivity: Bixby supports pkg=null
2018-10-22 15:00:30.604 12453-12453/? W/ResolverActivity: mLaunchedFromPackage = com.app
2018-10-22 15:00:30.605 12453-12453/? W/SShareCommon: getQuickConnectSupportState - oneconnect isn't installed
2018-10-22 15:00:30.605 12453-12453/? W/System.err: android.content.pm.PackageManager$NameNotFoundException: com.samsung.android.oneconnect
2018-10-22 15:00:30.605 12453-12453/? W/System.err: at android.app.ApplicationPackageManager.getPackageInfoAsUser(ApplicationPackageManager.java:288)
2018-10-22 15:00:30.605 12453-12453/? W/System.err: at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:259)
2018-10-22 15:00:30.605 12453-12453/? W/System.err: at com.samsung.android.share.SShareCommon.getSamsungConnectVersion(SShareCommon.java:535)
2018-10-22 15:00:30.605 12453-12453/? W/System.err: at com.samsung.android.share.SShareCommon.checkSamsungConnectInfo(SShareCommon.java:529)
2018-10-22 15:00:30.605 12453-12453/? W/System.err: at com.samsung.android.share.SShareCommon.<init>(SShareCommon.java:98)
2018-10-22 15:00:30.605 12453-12453/? W/System.err: at com.android.internal.app.ResolverActivity.configureContentView(ResolverActivity.java:1283)
2018-10-22 15:00:30.606 12453-12453/? W/System.err: at com.android.internal.app.ResolverActivity.onCreate(ResolverActivity.java:446)
2018-10-22 15:00:30.606 12453-12453/? W/System.err: at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:333)
2018-10-22 15:00:30.606 12453-12453/? W/System.err: at android.app.Activity.performCreate(Activity.java:7183)
问题是,我什至没有使用一个连接。我只是想调出标准的 android 共享屏幕,用户可以在其中选择他想要共享的应用程序。这很奇怪。任何提示?有没有人注意到这样的事情?