Opening browser with specific URI in Android

Sometimes you need to open browser with specific URI from your application.
For example you want to show application’s page and so on.
This operation is very simple.
You need to use Activity as usual you use it for walking from one activity to other.
In this post I am going to show snippet of code about how you can open browser with specific URI,also I will show how you can get your URI which is located in strings.xml:

Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://thedevelopersinfo.com"));startActivity(intent);

And also if your URI is in strings.xml:

Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(getResources().getString(R.string.your_link)));startActivity(intent);

As you can see it is simple.

I hope it was useful for you.

Share

No related posts.

2 comments to Opening browser with specific URI in Android

Leave a Reply

  

  

  

You can use these HTML tags

<a href=""title=""><abbr title=""><acronym title=""><b><blockquote cite=""><cite><code><del datetime=""><em><i><q cite=""><strike><strong>

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna,tincidunt vitae molestie nec,molestie at mi. Nulla nulla lorem,suscipit in posuere in,interdum non magna.