ProgressBar RuntimeException

Inman

Well-Known Member
Licensed User
Longtime User
I am trying to add a ProgressBar to my activity. I merely tried to initialise the ProgessBar using pbar.Initialize("pbar") and I get the error:

java.lang.RuntimeException: <internal>: You must supply a layout_height attribute.

The activity has some lables and imageviews before this line of code and everything works fine except for the ProgressBar. I didn't even add it to the activity using Activity.addview. I just initialised the ProgressBar before adding and got the following error. Any idea why?

NB:- I have enabled Do Not Overwrite Manifest File, due to some custom permissions I added. I assume ProgressBar is like any other view and doesn't need any special entries in the Manifest file.
 

klaus

Expert
Licensed User
Longtime User
Without any code it's impossible to give you an answer.
The best way to get a concrete and efficient help is to post your project as a zip file (IDE menu 'File/Exports As Zip'). That way we know what you have done and how. Otherwise we need to guess what you could have done, what you should have done and what you probably have done wrong and additionnaly create a project trying to reproduce the problem you have. Time consuming, boring and unefficient.

Best regards.
 
Upvote 0

Inman

Well-Known Member
Licensed User
Longtime User
Without any code it's impossible to give you an answer.
The best way to get a concrete and efficient help is to post your project as a zip file (IDE menu 'File/Exports As Zip'). That way we know what you have done and how. Otherwise we need to guess what you could have done, what you should have done and what you probably have done wrong and additionnaly create a project trying to reproduce the problem you have. Time consuming, boring and unefficient.

Due to the nature of the project, I cannot post the complete source code.

So for the convenience of the community, I created a new project which contains just the following lines:

B4X:
Sub Globals
   Dim pb As ProgressBar
End Sub

Sub Activity_Create(FirstTime As Boolean)
   pb.Initialize("pb")
   activity.AddView(pb,20dip,20dip,20dip,20dip)
End Sub

And I still get the error. The project has been attached.
 

Attachments

  • progressbar test.zip
    4.8 KB · Views: 264
Upvote 0

klaus

Expert
Licensed User
Longtime User
The code you posted works with the Emulator.
Do you really want such a small ProgressBar
width 20dip
height 20 dip
Try to increase these values to see if it solves the problem (especially the height value according to the error message).

Best regards.
 
Upvote 0

Inman

Well-Known Member
Licensed User
Longtime User
Changing the layout values didn't fix it. But it looks like the issue is for my device only.

I have a Nexus One running MIUI 1.6.3 (Android 2.3.4) and I get the above error. Then I mailed the apk to a friend, who tested on his Samsung Galaxy S2 running 2.3.4 and it worked fine there. Must be some issue with the MIUI rom. Let me see if I can find someone running a recent build of MIUI and see if he gets this error.

Sorry for the trouble guys. This error might be device and rom specific.
 
Upvote 0
Top