0

In my android application I want to redirect the users to my twitter profile page and I use this code :

Inrent i : new Intent(Intent.ACTION_VIEW,Uri.parse(''https://www.twitter.com/MYUSER));
startActivity(i);

If I choose the browser it work fine but if I choose twitter application it show a Toast "Impossible to.complete the action". How can I resolve this problem ? Thanks

Chilledrat
  • 2,608
  • 3
  • 27
  • 37
MimmoG
  • 581
  • 3
  • 11
  • 25

1 Answers1

1

I believe you are missing the setData() method:

String url = "http://twitter.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

Please read more here: How can I open a URL in Android's web browser from my application?

Let me know if this helps!

Community
  • 1
  • 1
Jared Burrows
  • 50,718
  • 22
  • 143
  • 180