HtmlImport2Activity.java
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class HtmlImport2Activity extends Activity {
/** Called when the activity is first created. */
final Activity activity = this;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
getWindow().requestFeature(Window.FEATURE_PROGRESS);
WebView webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
activity.setProgress(progress * 1000);
}
});
Toast.makeText(activity, "Application has Stoped Working..! " + description, Toast.LENGTH_SHORT).show();
}
});
webview.loadUrl("http://www.Google.com/");
}
package html.import2;
import
android.app.Activity;
import android.os.Bundle;import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class HtmlImport2Activity extends Activity {
/** Called when the activity is first created. */
final Activity activity = this;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
getWindow().requestFeature(Window.FEATURE_PROGRESS);
WebView webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
activity.setProgress(progress * 1000);
}
});
webview.setWebViewClient(new WebViewClient() {
public void
onReceivedError(WebView view, int errorCode, String description, String
failingUrl) {Toast.makeText(activity, "Application has Stoped Working..! " + description, Toast.LENGTH_SHORT).show();
}
});
webview.loadUrl("http://www.Google.com/");
}
}
No comments:
Post a Comment