1

I coded an intent to start twitter app but it's throwing ActivityNotFoundException even when I have the layest version of twitter installed.

My Code

Intent twitShare = new Intent()
                        .setType("text/plain")
                        .setPackage("com.twitter.android")
                        .setData(Uri.parse(url))
                        .setAction(Intent.ACTION_SEND);
                    startActivity(twitShare);

Please , what am I doing wrong?

X09
  • 3,827
  • 10
  • 47
  • 92

1 Answers1

1

Remove setData() from your Intent. ACTION_SEND does not use the data facet of the Uri. Follow the instructions in the ACTION_SEND documentation to supply your data to send, either via EXTRA_TEXT or EXTRA_STREAM.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491