/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_NO_TITLE); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); // This builds the view. We could probably get away with NOT having a LinearLayout, but I like // having a bucket! LinearLayout.LayoutParams containerParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 0.0F); LinearLayout.LayoutParams webviewParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 1.0F); root = new LinearLayout(this); root.setOrientation(LinearLayout.VERTICAL); root.setBackgroundColor(Color.BLACK); root.setLayoutParams(containerParams); appView = new WebView(this); appView.setLayoutParams(webviewParams); WebViewReflect.checkCompatibility(); if (android.os.Build.VERSION.RELEASE.startsWith("2.")) appView.setWebChromeClient(new EclairClient(this)); else { appView.setWebChromeClient(new GapClient(this)); } appView.setInitialScale(100); appView.setVerticalScrollBarEnabled(false); WebSettings settings = appView.getSettings(); settings.setJavaScriptEnabled(true); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL); Package pack = this.getClass().getPackage(); String appPackage = pack.getName(); WebViewReflect.setStorage(settings, true, "/data/data/" + appPackage + "/app_database/"); // Disable cookies CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(false); // Turn on DOM storage! WebViewReflect.setDomStorage(settings); // Turn off native geolocation object in browser - we use our own :) WebViewReflect.setGeolocationEnabled(settings, true); /* Bind the appView object to the gap class methods */ bindBrowser(appView); if (cupcakeStorage != null) cupcakeStorage.setStorage(appPackage); root.addView(appView); setContentView(root); }