Android Question Using requestWindowFeature() in B4A

corwin42

Expert
Licensed User
Longtime User
With the new StdActionBar library available I'm trying to add a progress bar to the ActionBar.

To enable the progress bar a window feature has to be requested. In Java this is done like this:

B4X:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

I added the following code to Activity_Create sub (5 is the value of Window.FEATURE_INDETERMINATE_PROGRESS:

B4X:
    Dim r As Reflector
    r.Target = r.GetActivity
    r.RunMethod4("requestWindowFeature", Array As Object (5), Array As String ("java.lang.int"))

The problem is that window features have to be requested before anything is added to the activity.

I get the following error:


I even tried to add the code to Globals or Process_Globals Subs but without luck.

Any chance to call this method?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…