tags:

views:

44

answers:

1

Wondering if anyone knows the most optimized way to handle opening an URL in android. Here is how I am doing it:

String tempUrl = helper.getUrl(tempString);
            Intent i = new Intent("android.intent.action.VIEW", Uri.parse("http://"+tempUrl));
            startActivity(i);

Must you start a new activity in order to open a URL?

A: 

I think you are using the correct way

 Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://"+tempUrl));
 startActivity(i);

other way would be loading your URL into a WebView.

myWebView.loadUrl(http://"+tempUrl);
Jorgesys