Gelöschter Account
- Forum-Beiträge: 460
02.06.2010, 13:47:41 via Website
02.06.2010 13:47:41 via Website
*.java
Layout.xml
AndroidManifest.xml
1public class NAME extends Activity {
2 private WebView webview;
3 /** Called when the activity is first created. */
4 @Override
5 public void onCreate(Bundle savedInstanceState) {
6 super.onCreate(savedInstanceState);
7
8 getWindow().requestFeature(Window.FEATURE_PROGRESS);
9
10 webview = new WebView(this);
11 setContentView(webview);
12 webview.getSettings().setJavaScriptEnabled(true);
13
14 final Activity activity = this;
15 webview.setWebChromeClient(new WebChromeClient() {
16 public void onProgressChanged(WebView view, int progress) {
17 activity.setProgress(progress * 100);
18 }
19 });
20
21 webview.setWebViewClient(new WebViewClient() {
22 public void onReceivedError(WebView view, int errorCode,
23String description, String failingUrl) {
24 Toast.makeText(activity,description,
25Toast.LENGTH_SHORT).show();
26 }
27 });
28 webview.loadUrl("URL");
29 }
2 private WebView webview;
3 /** Called when the activity is first created. */
4 @Override
5 public void onCreate(Bundle savedInstanceState) {
6 super.onCreate(savedInstanceState);
7
8 getWindow().requestFeature(Window.FEATURE_PROGRESS);
9
10 webview = new WebView(this);
11 setContentView(webview);
12 webview.getSettings().setJavaScriptEnabled(true);
13
14 final Activity activity = this;
15 webview.setWebChromeClient(new WebChromeClient() {
16 public void onProgressChanged(WebView view, int progress) {
17 activity.setProgress(progress * 100);
18 }
19 });
20
21 webview.setWebViewClient(new WebViewClient() {
22 public void onReceivedError(WebView view, int errorCode,
23String description, String failingUrl) {
24 Toast.makeText(activity,description,
25Toast.LENGTH_SHORT).show();
26 }
27 });
28 webview.loadUrl("URL");
29 }
Layout.xml
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent"
6 >
7<WebView
8 android:id="@+id/View"
9 android:layout_width="fill_parent"
10 android:layout_height="fill_parent"
11 />
12 </LinearLayout>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="vertical"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent"
6 >
7<WebView
8 android:id="@+id/View"
9 android:layout_width="fill_parent"
10 android:layout_height="fill_parent"
11 />
12 </LinearLayout>
AndroidManifest.xml
1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="PACKAGENAME"
4 android:versionCode="1" android:versionName="0.1">
5 <application android:icon="@drawable/icon" android:label="@string/app_name">
6 <activity android:name="NAME"
7 android:label="@string/app_name"
8 android:configChanges="keyboardHidden|orientation">
9 <intent-filter>
10 <action android:name="android.intent.action.MAIN" />
11 <category android:name="android.intent.category.LAUNCHER" />
12 </intent-filter>
13 </activity>
14 </application>
15 <uses-sdk android:minSdkVersion="3"/>
16<uses-permission android:name="android.permission.INTERNET" />
17<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
18</manifest>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="PACKAGENAME"
4 android:versionCode="1" android:versionName="0.1">
5 <application android:icon="@drawable/icon" android:label="@string/app_name">
6 <activity android:name="NAME"
7 android:label="@string/app_name"
8 android:configChanges="keyboardHidden|orientation">
9 <intent-filter>
10 <action android:name="android.intent.action.MAIN" />
11 <category android:name="android.intent.category.LAUNCHER" />
12 </intent-filter>
13 </activity>
14 </application>
15 <uses-sdk android:minSdkVersion="3"/>
16<uses-permission android:name="android.permission.INTERNET" />
17<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
18</manifest>
— geändert am 03.06.2010, 01:06:22
Grüße Alexander
Empfohlener redaktioneller Inhalt
Mit Deiner Zustimmung wird hier ein externer Inhalt geladen.
Mit Klick auf den oben stehenden Button erklärst Du Dich damit einverstanden, dass Dir externe Inhalte angezeigt werden dürfen. Dabei können personenbezogene Daten an Drittanbieter übermittelt werden. Mehr Infos dazu findest Du in unserer Datenschutzerklärung.