1

my source code with sapmle app.

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;  

public class AndroidMobileAppSampleActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        WebView mainWebView = (WebView) findViewById(R.id.mainWebView);

        WebSettings webSettings = mainWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);

        mainWebView.setWebViewClient(new MyCustomWebViewClient());
        mainWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

        mainWebView.loadUrl("http://qatarcarsale.com/");
    }

    private class MyCustomWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }
}

i want to be only using crome browser ,other browsers not support my site, how can i resolve this problem ?

sinan
  • 55
  • 1
  • 8

1 Answers1

0

Do you want to use only Chrome browser or you Don't?

Clarify it. Also, there is a really good answer in below 2 links. If you want to let users choose browser, see below link

How to load the application in Web-View in a specific browser like Chrome or Firefox in Android

If you want to handle browser settings by your self, See this,

https://stackoverflow.com/a/8941605/115145

Community
  • 1
  • 1
dhun
  • 643
  • 7
  • 13