i want to share image and text using intent but it is not work when facebook intent start it display only image i want to share both text and image
you can check the image here
List<Intent> targetShareIntents=new ArrayList<Intent>();
Intent shareIntent=new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
List<ResolveInfo> resInfos=getPackageManager().queryIntentActivities(shareIntent, 0);
if(!resInfos.isEmpty())
{
for(ResolveInfo resInfo : resInfos)
{
String packageName=resInfo.activityInfo.packageName;
Log.i("Package Name", packageName);
if(packageName.contains("com.facebook.katana"))
{
String imageurl="/storage/emulated/0/iWally/explosion_3-wallpaper-1024x768.jpg";
String text="hello how are you";
Intent intent=new Intent();
intent.setType("image/*");
intent.setComponent(new ComponentName(packageName, resInfo.activityInfo.name));
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT,text);
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+imageurl.toString()));
intent.setPackage(packageName);
targetShareIntents.add(intent);
}
}
if(!targetShareIntents.isEmpty())
{
System.out.println("Have Intent");
Intent chooserIntent=Intent.createChooser(targetShareIntents.remove(0), "Choose app to share");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetShareIntents.toArray(new Parcelable[]{}));
startActivity(chooserIntent);
}
else
{
Uri uri = Uri.parse("market://details?id=com.facebook.katana");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
System.out.println("Do not Have facebook");
}
}