X09
X09

Reputation: 3956

ActivityNotFoundException when trying to start twitter app

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?

Upvotes: 1

Views: 108

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007554

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.

Upvotes: 1

Related Questions