Reputation: 2782
I'm attempting to display loading progress for a WebView in an Android Activity. When I attempt to display the window's progress bar with:
requestWindowFeature( Window.FEATURE_PROGRESS );
as per http://developer.android.com/guide/appendix/faq/commontasks.html#progressbar but at this point I get a debugging error.
When the error occurs I see a new tab "ActivityThread.performLaunchActivity" in Eclipse which has a message "Source not found." and a button "Edit Source Lookup Path...".
When I remove the offending line I don't get this error.
What could be causing this problem? Do I need to set a permission in the AndroidManifest.xml file or is there something else I'm missing?
Upvotes: 5
Views: 12011
Reputation: 1
It was changing to targetSdkVersion to 19 that made mine not work. And it was specifically the function requestWindowFeature function that broke it all. I removed it from my Manifest xml and just used minSdkVersion to 8 and it worked.
Upvotes: 0
Reputation: 116
aliosmeen is right. You need extend Activity
instead of ActionBarActivity
. Both classes for some reason implement the requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
method differently. I did it this way and it does not crash anymore. Although, you must call the requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
method before you call the setContentView()
method.
Upvotes: 0
Reputation: 99
Use:
public class MainActivity extends Activity
instead of:
public class MainActivity extends ActionBarActivity
Upvotes: 5
Reputation: 73494
Make sure you are calling requestWindowFeature( Window.FEATURE_PROGRESS );
before you call setContentView()
in onCreate()
.
Upvotes: 2
Reputation: 44919
Have you tried making your requestWindowFeature()
call before you call setContentView()
?
This is necessary according to this post.
The docs for Window.requestFeature():
Enable extended screen features. This must be called before setContentView(). May be called as many times as desired as long as it is before setContentView().
Upvotes: 13