How to share gif with facebook, twitter, etc. In Android?

I want to share .gif with my application on facebook, twitter, etc. I can share a simple image like .png with facebook, twitter, but I can not share any graphic image .gif. Actually, I want to split the .gif image with the URL. So, at first I tried to split the .gif image from the SD card and succeed, but could not succeed using the URL and the URL. How can I share a .gif image in these two ways? The code below is sharing .gif with sdcard successfully.

File dir = Environment.getExternalStorageDirectory(); File yourFile = new File(dir, "g1.gif"); Uri pngUri = Uri.fromFile(yourFile); //Not working from URL //Uri pngUri = Uri.parse("http://www.gamecastor.com/iphoneapps/emoji/gangnamemoji/Group1/g1.gif"); //Not working from drawable //Uri pngUri = Uri.parse("android.resource://com.example.asd/drawable/g1.gif"); Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("image/*"); shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, pngUri); //code to share to facebook only PackageManager pm = getApplicationContext().getPackageManager(); List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0); for (final ResolveInfo app : activityList) { if ((app.activityInfo.name).contains("facebook")) { final ActivityInfo activity = app.activityInfo; final ComponentName name = new ComponentName(activity.applicationInfo.packageName,activity.name); shareIntent.addCategory(Intent.CATEGORY_LAUNCHER); shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); shareIntent.setComponent(name); startActivity(shareIntent); } } 
+4
source share

All Articles