Wednesday, 12 March 2014

Open specific URL in to Browser Intent

1)Take any URL that you want to open

   String url = "http://www.google.com";

2) create intent object 
android.content.Intent.Intent(String action)
Create an intent with a given action. All other fields (data, type, class) are null. Note that the action must be in a namespace because Intents are used globally in the system -- for example the system VIEW action is android.intent.action.VIEW;
Intent ACTION_VIEW

that is
   Intent i = new Intent(Intent.ACTION_VIEW);
3) from that intent object use this Intent android.content.Intent.setData(Uri data) method pass URI into them
   i.setData(Uri.parse(url));

4) And normaly start activity by passing that created intent
   startActivity(i);


GOOD LUCK

No comments:

Post a Comment