0

In my app i want to post a photo in twitter in a button click.
so i uses so many code but does not work. so i want to get the code to share a photo in twitter in one click

Nithinlal
  • 4,845
  • 1
  • 29
  • 40

2 Answers2

2

Before going to ask question. Try to google or search on SO for the similar questions.

See here:see here

Community
  • 1
  • 1
Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188
1

Try this:

                Intent targetedShare = new Intent(android.content.Intent.ACTION_SEND);
                targetedShare.setType("image/jpeg"); // put here your mime type
                targetedShare.putExtra(Intent.EXTRA_TEXT,     "My body of post/email");
                targetedShare.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagePath)) );

                Intent chooserIntent = Intent.createChooser(targetedShare, "Select app to share");
                chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShare);
                startActivity(chooserIntent);
yahya.can
  • 1,790
  • 1
  • 11
  • 9