Android Question 3 Progressbar questions

grafsoft

Well-Known Member
Licensed User
Longtime User
Hi,

1. I have a pgrogressbar, not created with the designer.

I get a crash with "java.lang.NullPointerException: Attempt to write to field 'int anywheresoftware.b4a.BALayout$LayoutParams.left' on a null object reference"

B4X:
Sub Globals
  
    Dim PB As ProgressBar
End Sub


Sub Activity_Create(FirstTime As Boolean)
    PB.initialize ("Progress")
    PB.Visible=False
    PB.SetLayout (10%x,45%y,80%x,10%y) ' crashes here
    PB.color=Main.a400color

2. I want to intercept the event when the progressbar has reached 100%, like "Sub Progress_Jobdone"

I know the trick with sub + blank + tab, but I don't get any help pn progressbar. When I try to use the designer (Generate members) - same result.

3. It must be my fault, but I do not find any documentation on this object.
 
Last edited:

klaus

Expert
Licensed User
Longtime User
1) You must add the ProgressBar onto the Activity or a Panel liky any other view added in the code !
Activity.AddView(PB, 10%x,45%y,80%x,10%y)
instead of
PB.SetLayout (10%x,45%y,80%x,10%y)

2) What do expect ?
There is nothing 'automatic' in this view it only shows a progress but it's up to you to change the progress value depending on the function you execute, so you should know when it's finished.

3) This is from the Help.
 
Last edited:
Upvote 0
Top