0

I am attempting to learn how to use the Android NavigationDrawer and I created a small demo app by copying the code seen here https://github.com/javatechig/AndroidNavigationDrawer. I was able to successfully compile the code and run the app, but whenever I select one of the choices in the NavigationDrawer to open up a webpage in the WebView, I see nothing within the Webview. My logcat is showing no errors, but I am receiving a message that says:

W/AwContents: nativeOnDraw failed; clearing to background color

I have attempted the solutions proposed in this question here, but none of them have seemed to resolve my issue. If somebody could help me figure out how to get these web pages to appear in the WebView, that would much appreciated.

Edit: FYI, my project SDK is the Android API 19 Platform and I am working in JetBrains IntelliJ community edition.

Community
  • 1
  • 1
Patr3xion
  • 122
  • 2
  • 15

2 Answers2

0

What you gonna need to do is to set a WebViewclient for your WebView like this (WebViewFragment.java):

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,    
BundlesavedInstanceState) {

//some code
webView.setWebViewClient(new WebViewClient());

}

Now, all your invoked urls (from the NavigationDrawer) will stay inside the WebView. If you wanna change this behaviour, you can e.g. override the loadUrl-method of the WebView class. If a link is clicked by the user inside the webview, but you want to open the link in a external browser, then you have to override the shouldOverrideUrlLoading-method of the WebViewClient class.

A.D.
  • 1,412
  • 2
  • 19
  • 37
0

I think that if you remove all fragments, background colour, and images before trying again, it will work.

Patrice
  • 4,641
  • 9
  • 33
  • 43
Sushant Patil
  • 51
  • 1
  • 2