java - When i click on any link on android studio app then app is closed,how can i solve it? -


i have use webview , html5,but doesn't work link page. have many other page,but not open. mainactivity.java:

package me.zahidul.zahidwebapp;  import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.webkit.webview;  public class mainactivity extends appcompatactivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         string myurl = "file:///android_asset/index.html";         webview view = (webview) this.findviewbyid(r.id.webview);         view.getsettings().setjavascriptenabled(true);         view.loadurl(myurl);     } } 

activity_main.xml:

<?xml version="1.0" encoding="utf-8"?> <relativelayout 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/activity_main"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:paddingbottom="0dp"     android:paddingleft="0dp"     android:paddingright="0dp"     android:paddingtop="0dp"     tools:context="me.zahidul.zahidwebapp.mainactivity">      <webview         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_alignparentleft="true"         android:layout_alignparentstart="true"         android:id="@+id/webview" >      </webview> </relativelayout> 

index.html:

//just menu part  <div class="menu">            <ul>                <li><a href="index.html">home</a></li>                <li><a href="about.html">about us</a></li>                <li><a href="tution.html">tution , fees</a></li>                <li><a href="administration.html">administration</a></li>                <li><a href="faculty.html">faculty</a></li>                <li><a href="result.html">result</a></li>             </ul>        </div> 

when click link show app has stop,please tell me solution?

you need add permission in androidmanifest.xml -

<uses-permission android:name="android.permission.internet" /> 

it should work then, if doesnt please share logcat can out in better way.

cheers!


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -