In the latest update of WhatsApp it is allowing other applications to share gif images. It is quite similar to normal intent image sharing method in android. In this tutorial we will learn how to share gif images to WhatsApp or to any other application which allows sharing like Gmail , facebook etc.
Following is the function which is used to share the gif images
private void ShareGif() { // replace the path and file name with your gif image path and name String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath(); String fileName = "temporary_file.gif"; File sharingGifFile = new File(baseDir, fileName); Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("image/gif"); Uri uri = Uri.fromFile(sharingGifFile); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); startActivity(Intent.createChooser(shareIntent, "Share image")); }
You can call the above function whenever you want to share gif by replacing the path to your gif image path in your code.
This will popup a dialog containing all apps which allows sharing, you can pick whatsapp , facebook , gmail etc based on your requirement.
sir, plz.. plzzz… plzzzz… give me full code
how to share drawable gif on whats app