java - Android webview whitescreen -


i looked many times , changed code should work (e.g. verified answer on stackoverflow), still doesn't work , don't know why.

so created webview , want display page. tried google.com, white space on window webview lays (no errors, unclickable white space)

here's code:

main activity:

protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);         setsupportactionbar(toolbar);        /*webview wv = (webview) findviewbyid(r.id.webview);        wv.setwebviewclient(new mybrowser());          wv.loadurl("http:\\www.google.com");         */          drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout);         actionbardrawertoggle toggle = new actionbardrawertoggle(                 this, drawer, toolbar, r.string.navigation_drawer_open, r.string.navigation_drawer_close);         drawer.setdrawerlistener(toggle);         toggle.syncstate();          navigationview navigationview = (navigationview) findviewbyid(r.id.nav_view);         if (navigationview != null) {             navigationview.setnavigationitemselectedlistener(this);         }          fragmentmanager fragmentmanager = getfragmentmanager();         fragmentmanager.begintransaction().replace(r.id.frame_main, new home()).commit();         webview w = (webview) findviewbyid(r.id.webview);         w.getsettings().setjavascriptenabled(true);         w.getsettings().setloadwithoverviewmode(true);         w.getsettings().setusewideviewport(true);         w.setwebviewclient(new webviewclient(){             @override             public boolean shouldoverrideurlloading(webview view,string url){             view.loadurl(url);             return true;             }         });         w.loadurl("http://www.google.com");     } 

the commented thing other option same result

i posting whole thing here because think maybe have fact running sidebar activity fragments.

i added permission in manifest, please tell me why it's not working

ps: phone has working internet connection

here xml-file

<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     app:layout_behavior="@string/appbar_scrolling_view_behavior"     tools:context="myadress.mainactivity"     tools:showin="@layout/app_bar_main">      <webview         android:layout_width="match_parent"         android:layout_height="400sp"         android:id="@+id/webview"         tools:layout_editor_absolutey="0dp"         tools:layout_editor_absolutex="8dp">       </webview>  </android.support.constraint.constraintlayout> 

activity main xml

<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/drawer_layout"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:fitssystemwindows="true"     tools:opendrawer="start">      <include         layout="@layout/app_bar_main"         android:layout_width="match_parent"         android:layout_height="match_parent" />      <framelayout         android:id="@+id/frame_main"          android:layout_width="match_parent"         android:layout_height="match_parent" />      <android.support.design.widget.navigationview         android:id="@+id/nav_view"         android:layout_width="wrap_content"         android:layout_height="match_parent"         android:layout_gravity="start"         android:fitssystemwindows="true"         app:headerlayout="@layout/nav_header_main"         app:menu="@menu/activity_main_drawer" />  </android.support.v4.widget.drawerlayout> 


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -