Home
AIDE (Mobile)
Android Studio
Android Studio (AIDE)
Apps
Source files
WebView AIDE Tutorial and Source File Free
WebView AIDE Tutorial and Source File Free
WebView AIDE Tutorial and Source Codes Free
main.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:id="@+id/wp">
<WebView
android:id="@+id/web"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/pb"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>
MainActivity.java
package com.w4apk.webview;
import android.app.*;
import android.os.*;
import android.webkit.*;
import android.widget.*;
import android.view.*;
public class MainActivity extends Activity
{
private WebView web;
private FrameLayout wp;
private ProgressBar pb;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
web=(WebView)findViewById(R.id.web);
wp=(FrameLayout)findViewById(R.id.wp);
pb=(ProgressBar)findViewById(R.id.pb);
WebSettings WebSettings= web.getSettings();
WebSettings.setJavaScriptEnabled(true);
web.loadUrl("http://w4apk.blogspot.com");
web.setWebViewClient(new WebViewClient(){
@Override
public void onPageFinished(WebView View, String url){
wp.removeView(pb);
}
});
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.w4apk.webview" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
No comments:
Post a Comment