Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)

I want to print something in console, so that I can debug it. But for some reason, nothing prints in my Android application.

How do I debug then?

public class HelloWebview extends Activity {

    WebView webview;    

    private static final String LOG_TAG = "WebViewDemo";

    private class HelloWebViewClient extends WebViewClient {

        @Override

        public boolean shouldOverrideUrlLoading(WebView view, String url) {

            view.loadUrl(url);

            return true;

        }

    }

    /** Called when the activity is first created. */

    @Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);

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

        webview.setWebViewClient(new HelloWebViewClient());

        webview.getSettings().setJavaScriptEnabled(true);

        webview.setWebChromeClient(new MyWebChromeClient());

        webview.loadUrl("http://example.com/");    

        System.out.println("I am here");

    }

1 Answer

0 votes
by (46k points)

Use the Log class. Output visible with LogCat

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...