Nun schaffe ich es zumindest es anzeigen zu lassen nur öffnet sich nun die webseite nicht (wird nicht angezeigt):
1package de.progress.app;
2
3import android.app.*;
4import android.util.Log;
5import android.view.*;
6import android.webkit.*;
7import android.widget.*;
8import android.content.*;
9import android.app.Activity;
10import android.os.Bundle;
11
12public class Progress extends Activity {
13 private static final int AKTUALISIEREN = 0;
14 private static final int BEENDEN = 1;
15 private WebView webview;
16 private ProgressDialog progressBar;
17 private static final String TAG = "Main";
18
19 //Zoom
20 private static final FrameLayout.LayoutParams ZOOM_PARAMS =
21 new FrameLayout.LayoutParams(
22 ViewGroup.LayoutParams.FILL_PARENT,
23 ViewGroup.LayoutParams.WRAP_CONTENT,
24 Gravity.BOTTOM);
25 //Zoom
26
27 /** Called when the activity is first created. */
28 @Override
29 public void onCreate(Bundle savedInstanceState) {
30 super.onCreate(savedInstanceState);
31
32 webview = new WebView(this);
33 setContentView(webview);
34 webview.getSettings().setJavaScriptEnabled(true);
35 webview.getSettings().setPluginsEnabled(true);
36
37 //Zoom
38 FrameLayout mContentView = (FrameLayout) getWindow().
39 getDecorView().findViewById(android.R.id.content);
40 final View zoom = this.webview.getZoomControls();
41 mContentView.addView(zoom, ZOOM_PARAMS);
42 zoom.setVisibility(View.GONE);
43 //Zoom
44
45 final Activity activity = this;
46
47 final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
48
49 progressBar = ProgressDialog.show(this, "Loading", "Loading...");
50
51 webview.setWebViewClient(new WebViewClient() {
52 public boolean shouldOverrideUrlLoading(WebView view, String url) {
53 Log.i(TAG, "Processing webview url click...");
54 view.loadUrl(url);
55 return true;
56 }
57
58 public void onPageFinished(WebView view, String url) {
59 Log.i(TAG, "Finished loading URL: " +url);
60 if (progressBar.isShowing()) {
61 progressBar.dismiss();
62 }
63 }
64
65 public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
66 Log.e(TAG, "Error: " + description);
67 Toast.makeText(activity, description, Toast.LENGTH_SHORT).show();
68 alertDialog.setTitle("Error");
69 alertDialog.setMessage(description);
70 alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
71 public void onClick(DialogInterface dialog, int which) {
72 return;
73 }
74 });
75 alertDialog.show();
76 }
77 });
78 webview.loadUrl("http://www.google.de/");
79 }
80}