On Sep 9, 4:50 pm, Felix Schröter <fels...@googlemail.com> wrote: > Hi everyone, > I´m 15 years old (in a few weeks 16) and I´m very new to Android and Java > and at the moment I just copy and past, but I want to learn the language > Java complete but later. > So my Problem: > I didn´t deavticate the title bar in the manifest, because I have an > ProgessBar to show how long it tooks to load the Page (webview). > Know I want to deactivate the title bar after it loaded 100%. I found " > requestWindowFeature(Window.FEATURE_NO_TITLE);" as an option, but when I use > it the app crashes when 100% is loaded. So here my whole code: > > package de.iapptipps; > > import android.app.Activity; > import android.os.Bundle; > import android.view.KeyEvent; > import android.view.Window; > import android.webkit.WebChromeClient; > import android.webkit.WebView; > import android.webkit.WebViewClient; > import android.widget.Toast; > > public class IAppTippsActivity extends Activity > { > private WebView webview; > @Override > public void onCreate(Bundle savedInstanceState) > { > getWindow().requestFeature(Window.FEATURE_PROGRESS); > setContentView(R.layout.main); > > super.onCreate(savedInstanceState); > webview = new WebView(this); > setContentView(webview); > webview.getSettings().setJavaScriptEnabled(true); > > final Activity activity = this; > { > webview.setWebChromeClient(new WebChromeClient() > { > public void onProgressChanged(WebView view, int progress) > { > activity.setTitle(" Lädt..."); > activity.setProgress(progress * 100); > if(progress == 100) > requestWindowFeature(Window.FEATURE_NO_TITLE); > } > }); > } > > webview.setWebViewClient(new WebViewClient() > { > public void onReceivedError(WebView view, int errorCode, > String description, String failingUrl) > { > Toast.makeText(activity,description, > Toast.LENGTH_SHORT).show(); > } > }); > webview.loadUrl("http://iapptipps.de"); > } > @Override > public boolean onKeyDown(int keyCode, KeyEvent event) > { > if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) > { > webview.goBack(); > return true; > } > return super.onKeyDown(keyCode, event); > } > > } > > And here my Manifest: > > <?xml version="1.0" encoding="utf-8"?> > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="de.iapptipps" > android:installLocation="auto" android:versionCode="4" > android:versionName="1.0.3"> > <uses-sdk android:minSdkVersion="7" /> > <uses-permission android:name="android.permission.INTERNET" /> > > <application android:label="@string/app_name" > android:icon="@drawable/icon1"> > <activity android:name=".IAppTippsActivity" > android:label="@string/app_name" > android:theme="@android:style/Theme"> > <intent-filter> > <action android:name="android.intent.action.MAIN" /> > <category android:name="android.intent.category.LAUNCHER" /> > </intent-filter> > </activity> > </application> > </manifest> > > And the main.xml: > > <?xml version="1.0" encoding="utf-8"?> > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" > android:orientation="vertical" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > > <WebView android:id="@+id/webview" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > /> > </LinearLayout> > > Know I postet my whole app. > I hope you can help me. I tested the app an 2.3.3, 2.1 and 3.2 on my virtual > machines all crashing. > Thank you!
Maybe this will help: http://stackoverflow.com/questions/4250149/requestfeature-must-be-called-before-adding-content pskink -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en