Thursday, 6 August 2015

android.util.AndroidRuntimeException: requestFeature() must be called before adding content


android.util.AndroidRuntimeException: requestFeature() must be called before adding content

Don't call setContentView() before requestFeature().
Note:
As said in comments, for both ActionBarSherlock and AppCompat library, it's necessary to call requestFeature() before super.onCreate()

http://stackoverflow.com/questions/4250149/requestfeature-must-be-called-before-adding-content


However, if you are doing this just because you are following the sample code for the "more complicated sample" of webView at http://developer.android.com/intl/zh-cn/reference/android/webkit/WebView.html  Then I have to tell you, the document is out of date.

Somebody has worked it out, however they are using different Activity (which is not recommented):

https://teamtreehouse.com/forum/progress-bar-doesnt-appear-in-android-project-with-setprogressbarindeterminatevisibility

http://stackoverflow.com/questions/3092291/android-the-progress-bar-in-the-windows-title-does-not-display


Jacob Bergdahl:

However, this is not recommended. An up-to-date app should use AppCompat and your activity should implement ActionBarActivity. You're basically going into an older version, which is fine, however it's not recommended to do so.






No comments:

Post a comment