1
我得到烤麪包Image Could Not Be Loaded
當我嘗試並將圖像URL附加到推文。我改變了類型,但仍然沒有工作。Twitter與文本共享圖像,烤麪包「圖像無法加載」
我的意圖代碼:
String imageUrl="http://www.cyclesoon.com/admin/assets/img/rideimages/1499161893615.jpg";
Intent tweetIntent = new Intent(Intent.ACTION_SEND);
tweetIntent.putExtra(Intent.EXTRA_TEXT, "Join ride");
tweetIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(imageUrl));
tweetIntent.setType("image/png");
PackageManager packManager = context.getPackageManager();
List<ResolveInfo> resolvedInfoList = packManager.queryIntentActivities(tweetIntent, PackageManager.MATCH_DEFAULT_ONLY);
boolean resolved = false;
for (ResolveInfo resolveInfo : resolvedInfoList) {
if (resolveInfo.activityInfo.packageName.startsWith("com.twitter.android")) {
tweetIntent.setClassName(resolveInfo.activityInfo.packageName,resolveInfo.activityInfo.name);
resolved = true;
break;
}
}
if (resolved) {
startActivity(tweetIntent);
} else {
Intent i = new Intent();
i.putExtra(Intent.EXTRA_TEXT, "");
i.setAction(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://twitter.com/intent/tweet?text=" + urlEncode("")));
startActivity(i);
}
任何解決方案表示讚賞。