GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — AndroidTutorialForBeginners/WebView.txt at master · FiresideCode/AndroidTutorialForBeginners Expand file tree/ Copy pathWebView.txtMore file actions 122 lines (97 loc) · 3.52 KB / Copy pathWebView.txtFile metadata and controls122 lines (97 loc) · 3.52 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 //layout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.hussienalrubaye.androidpermission.MainActivity"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="textPersonName" android:text="" android:hint="Enter URL" android:ems="10" android:id="@+id/etURL" android:layout_weight="1" /> <Button android:onClick="buGo" android:text="Go" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button2" android:layout_weight="1" /> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:onClick="buBack" android:text="Back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button4" android:layout_weight="1" /> <Button android:text="Forword" android:onClick="buForword" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button3" android:layout_weight="1" /> </LinearLayout> <WebView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/wv1" /> </LinearLayout> </RelativeLayout> // java code public class MainActivity extends AppCompatActivity { //TextView tvDisplay; EditText etURL; WebView wv1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // tvDisplay=(TextView)findViewById(R.id.tvDisplay); wv1=(WebView)findViewById(R.id.wv1); wv1.setWebViewClient(new myWebView()); wv1.getSettings().setJavaScriptEnabled(true); wv1.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); etURL=(EditText)findViewById(R.id.etURL); wv1.loadUrl("http://alruabye.net"); } public void buGo(View view) { LoadURL(etURL.getText().toString()); } void LoadURL(String url){ this.url=url; wv1.loadUrl(url); } public void buBack(View view) { wv1.goBack(); } public void buForword(View view) { wv1.goForward(); } private class myWebView extends WebViewClient{ @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request){ return true; } } } //acces to internet <uses-permission android:name="android.permission.INTERNET"></uses-permission> |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |