diff --git a/src/com/nitobi/phonegap/DroidGap.java b/src/com/nitobi/phonegap/DroidGap.java index bbf87673..056d7312 100644 --- a/src/com/nitobi/phonegap/DroidGap.java +++ b/src/com/nitobi/phonegap/DroidGap.java @@ -21,14 +21,13 @@ package com.nitobi.phonegap; * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Field; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.util.Log; +import android.view.Window; +import android.view.WindowManager; import android.webkit.JsResult; import android.webkit.WebChromeClient; import android.webkit.WebView; @@ -44,6 +43,9 @@ public class DroidGap extends Activity { @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); setContentView(R.layout.main); appView = (WebView) findViewById(R.id.appView); @@ -57,47 +59,13 @@ public class DroidGap extends Activity { /* Bind the appView object to the gap class methods */ bindBrowser(appView); - /* Load a URI from the strings.xml file */ - String uri = null; - Class c = R.string.class; - Field f; - int i = 0; - - try { - f = c.getField("url"); - i = f.getInt(f); - uri = this.getResources().getString(i); - } catch (Exception e) - { - uri = "http://www.phonegap.com"; - } + - appView.loadUrl(uri); + appView.loadUrl("file:///android_asset/index.html"); } - protected void loadFile(WebView appView){ - try { - InputStream is = getAssets().open("index.html"); - - int size = is.available(); - - // Read the entire asset into a local byte buffer. - byte[] buffer = new byte[size]; - is.read(buffer); - is.close(); - - // Convert the buffer into a Java string. - String text = new String(buffer); - - // Load the local file into the webview - appView.loadData(text, "text/html", "UTF-8"); - - } catch (IOException e) { - // Should never happen! - throw new RuntimeException(e); - } - } + private void bindBrowser(WebView appView) {