Hello ,
Ever thought to
include a feature in your application where user clicks a link of
certain site or your personal website in the about section of the
application and it opens the site in a window and when user finished
viewing your achievement and clicks back button your application again
gets displayed.
We are going to perform this in just two lines.
-
So first we have to create a intent.
As we already know intent is an abstract description of an operation to be performed.
So we are going to use another version of intent which has following format.
public Intent(String action,Uri uri)
Here:
action is the action we intent(i.e the action we want to perform).
uri is the URL on which the above action is to be performed.
create and intent as
Intent viewIntent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.wissen.co.in"));
The above intents means that we want the system to perform a View Action on uri “http://www.wissen.co.in” (i.e. To view it).
-
Next start this activity as:
startActivity(viewIntent);
-
The site will open in browser as
No comments:
Post a Comment