Force close when creating progressbar programmatically


Jul 21, 2011
Hi, I'm the developer of Beaver, a tabbed browser on the android market.

MIUI users are getting force closes when trying to run my app, and I've tracked down the bug to the creation of a horizontal progress bar. Android complains that a layout height wasn't specified and therefore force closes. I'm guessing that MIUI overrides the standard android themes. Here's the code I use to create my progressbar: you can use it to replicate this issue:

You can also see this issue when running the lite version of the app:

        RelativeLayout mRelative = new RelativeLayout(this);
        RelativeLayout.LayoutParams b = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, 20);
        loadingProgressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
        mRelative.addView(loadingProgressBar, b);

The standard android.R.attr.progressBarStyleHorizontal specifies minheight and minwidth attributes, possibly that's what the issue is?
I know very little about Java programming, but I don't think it's your program, because it seems you have the position of the progress bar set at a relative position, so it should accustome with the height and the width of the screen resolution, correct..?
Hi, I have the same problem with my app. Since I added a progress bar people that have miui have started complaining about FC.

stackTrace:java.lang.RuntimeException: Unable to resume activity {org.blockdroidpro/org.blockdroid.View.ShowResult}: java.lang.RuntimeException: <internal>: You must supply a layout_height attribute.

Without the progress bar (progressBarStyleHorizontal) everything works fine.
it is a known issue with MIUI and horizontal progress bar
there is an app i really like wich uses it but sadly on MIUI i cant use it hehe
would LOVE to find a way to get it working
this topic should be STICKY !