1

I am creating application in android here i want to call browser not default one but specific one like opera or someone else... Frankly speaking these browsers better than default one and also having more options..

I googled lot but i could able to get only to call default browser.

Here is code for call default browser

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.google.co.in"));

startActivity(intent);    

Pls any suggestion ...

Aristo Michael
  • 2,166
  • 3
  • 35
  • 43
  • Why do you need to call a specific browser? Why not let the system launch the user's default? They probably won't appreciate having their choice overridden. Also, how will you handle the situation where the browser you want is not installed? – eldarerathis Dec 16 '13 at 05:18
  • oh i never think in this way ... So its better to let the sys launch the users default.. thnx @eldarerathis – Aristo Michael Dec 17 '13 at 05:18

3 Answers3

1

Use WebView, For example, In xml,

<?xml version="1.0" encoding="utf-8"?>
<WebView  
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
/>

In java

public class WebViewActivity extends Activity {

    private WebView webView;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview);

        webView = (WebView) findViewById(R.id.webView1);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadUrl("http://www.google.com");

    }

}

In manifest file:

<uses-permission android:name="android.permission.INTERNET" />
No_Rulz
  • 2,679
  • 1
  • 20
  • 33
1

Please see: Android launch browser without specifying a URL

There you will find the code to getDefaultBrowserComponent(); the getNonDefaultBrowserComponent() will be an easy exercise.

Community
  • 1
  • 1
18446744073709551615
  • 16,368
  • 4
  • 94
  • 127
0

You can use Intent.setClassName() property before calling the startActivity() method. You have to specify package name and activity of your browser app.

Vaibhav Agarwal
  • 4,499
  • 3
  • 19
  • 20