I am going to post my code so the entire group can have a go at it. I
believe this is what many of the other forum members are looking for
as am I, to allow this in webview. As you can tell, I've tried
everything! I heard that the groups have the masterminds so please,
help me Google Jedi Order, you're my only hope.
package com.PopCultApps.GoogleJapan101;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebSettings;
import android.view.MenuItem;
public class GoogleJapan101 extends Activity { //** Called when the
activity is first created. */
public WebView webView; //DECLARE webview variable outside of
onCreate function so we can access it in other functions (menu)
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webView = (WebView) findViewById(R.id.webview); // Create an
instance of WebView
WebView webView = (WebView)findViewById(R.id.webview);
WebSettings webSettings = webView.getSettings(); // Fetches the
WebSettings import
WebViewClient webViewClient = new WebViewClient();
webView.setWebViewClient(webViewClient); // Enabling mp4
webSettings.setPluginsEnabled(true); // Allows plugins to run
which
are normally disabled in webView
webView.getSettings().setBuiltInZoomControls(true); // Allows
the
Android built in zoom control
webView.getSettings().setSaveFormData(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setPluginsEnabled(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setSupportMultipleWindows(true);
webView.getSettings().setPluginsEnabled(true);
webView.getSettings().setLightTouchEnabled(true);
webView.getSettings().setAllowFileAccess(true); // To allow file
downloads/streams such as mp4, mpeg, and 3gp files
webView.getSettings().setJavaScriptEnabled(true); // Enables
HTML
Javascript to run in webview
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setSupportZoom(true); // Support the zoom
feature
webView.getSettings().setSavePassword(true); // Allow users to
save
passwords in forms
webView.setWebViewClient(new WebViewClient() { // Opens web
links
clicked by user in the webview
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) { // Handle the
error
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String
url) {
view.loadUrl(url);
return true;
}
});
webView.loadUrl("http://m.rk.com/?
id=undacovabrotha&act=sites&page=1"); // Modify the URL for webview
here
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) { // Enables
browsing to previous pages with the hardware back button
if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack())
{ // Check if the key event was the BACK key and if there's history
webView.goBack();
return true;
} // If it wasn't the BACK key or there's no web page history,
bubble up to the default
// system behavior (probably exit the activity)
return super.onKeyDown(keyCode, event);
}
}
--
You received this message because you are subscribed to the Google Groups
"Android Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/android-discuss?hl=en.