Prabhu Konchada
Prabhu Konchada

Reputation: 548

Browser Pops while trying to display web page in the web view

I want to display a web page within web view rather than launching it in the browser but when I do this it opens up the browser without displaying it in the web view.

package com.example.prabhukonchada.ebolamyapp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;

public class WebViewActivity extends AppCompatActivity {

    private WebView mWebView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_view);

        String link = getIntent().getStringExtra("URL");

        mWebView = (WebView) findViewById(R.id.webView);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.loadUrl(link);

    }
}

Upvotes: 0

Views: 23

Answers (1)

hata
hata

Reputation: 12513

Use and set WebViewClient as described on Android Developer.

Upvotes: 1

Related Questions