I want to share the bitmap that I stored locally in my phone to twitter via my android application. Is it possible? Thank You!
Asked
Active
Viewed 1,434 times
-3
-
It is possible, Thank You! – Vigbyor Nov 15 '13 at 12:20
-
-2 votes? Thanks, And no one knows everything. I am a beginner. Can anyone give me a tip in doing that! – Sreejith SP Nov 15 '13 at 12:22
1 Answers
3
Yes you can give this code a try
try {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
Uri phototUri = Uri.parse("file:///sdcard/Pictures/yourimage.png");
shareIntent.setType("image/png");
shareIntent.putExtra(Intent.EXTRA_STREAM, phototUri);
shareIntent.setClassName("com.twitter.android","com.twitter.android.PostActivity");
startActivity(Intent.createChooser(shareIntent, "Share Image"));
} catch (Exception e) {
Intent i = new Intent();
i.putExtra(Intent.EXTRA_TEXT, message);
i.setAction(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://mobile.twitter.com/compose/tweet"));
startActivity(i);
}

the-ginger-geek
- 7,041
- 4
- 27
- 45
-
Thanks, I tried this already. But I want to share only on Twitter. This will pop up all the share options! – Sreejith SP Nov 15 '13 at 12:27
-
-
Have a look at this answer http://stackoverflow.com/questions/8308666/how-to-force-share-intent-to-open-a-specific-app – the-ginger-geek Nov 15 '13 at 12:34
-
Thanks! It also gives options like Picassa, Gmail , bluetooth, Whatsapp etc. I done facebook share with facebook sdk. I don't want to go out of my app! – Sreejith SP Nov 16 '13 at 06:05