Can any body tell me how can i share GIF image in android programmatically like.
Actually i want to share GIF image like android share .jpg or .png images.
I search a lot of but there is no link to share GIF image,please if anybody know please tell me.
code for sharing GIF image? startActivity(Intent.createChooser(shareIntent,"Share Emoji")); is used to share data using intent with the title "Share Emoji" whenever we share jpg or png it works perfectly. But if we try to send GIF images it does not work perfectly only email way works, if we select any other app to share GIF image like WhatsApp or Shareit, it converts GIF image to simple png image..... By this code only, i am unable to share GIF image with every other apps. So please check it and give me reasonable & practical solution if this is possible
Thank you
===============================================================
this is my code which i used currently
public class SplashScreen extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_main);
Button click = (Button) findViewById(R.id.click);
click.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
shareGif(getResources().getResourceName(R.drawable.clark));
}
});
}
private void shareGif(String resourceName) {
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
String fileName = "sharingGif.gif";
File sharingGifFile = new File(baseDir, fileName);
try {
byte[] readData = new byte[1024 * 500];
InputStream fis = getResources().openRawResource(getResources().getIdentifier(resourceName, "drawable", getPackageName()));
FileOutputStream fos = new FileOutputStream(sharingGifFile);
int i = fis.read(readData);
while (i != -1) {
fos.write(readData, 0, i);
i = fis.read(readData);
}
fos.close();
} catch (IOException io) {
}
System.out.println("===sharing file=="+sharingGifFile);
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 Emoji"));
}
}