Attached are new library files (JAR & XML) that will allow you to set 1 of 8 possible maximum values (10.0, 20.0, 50.0, 100.0, 200.0, 500.0, 750.0, 1000.0). Replace your library files with this.
Code example:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim t As Timer
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private gv As GaugeView
Private Label1 As Label
Dim ev As Float
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
t.Initialize("t",1500)
gv.TargetValue = 0
ev = 200.0 'Set ev to one of the following values only else error will occur ---> 10.0, 20.0, 50.0, 100.0, 200.0, 500.0, 750.0, 1000.0
gv.ScaleEndValue = ev
End Sub
Sub Activity_Resume
t.Enabled = True
End Sub
Sub Activity_Pause (UserClosed As Boolean)
t.Enabled = False
End Sub
Sub t_tick
Dim tgtValue, upper As Int
upper = ev
tgtValue = Rnd(0,upper+1)
Label1.Text = "Random Value Generate = " & tgtValue
gv.TargetValue = tgtValue
End Sub
GaugeView
Version: 1
- GaugeView
Fields:Methods:
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
Properties:
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- ScaleEndValue As Float [write only]
- ShowText As Boolean [write only]
- Tag As Object
- TargetValue As Float [write only]
- Top As Int
- Visible As Boolean
- Width As Int
Hi,
I am trying out GaugeView library and example above. However App crashes on Activity.LoadLayout("main") statement. Here is crash dump.
Installing file.
PackageAdded: package:b4a.gaugeview
Copying updated assets files (1)
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 34 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
at b4a.gaugeview.main._activity_create(main.java:358)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at b4a.gaugeview.main.afterFirstLayout(main.java:102)
at b4a.gaugeview.main.access$000(main.java:17)
at b4a.gaugeview.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5062)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:658)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 22 more
Caused by: java.lang.NullPointerException
at android.graphics.BitmapShader.<init>(BitmapShader.java:45)
at org.codeandmagic.android.gauge.GaugeView.getDefaultOuterRimPaint(GaugeView.java:388)
at org.codeandmagic.android.gauge.GaugeView.initDrawingTools(GaugeView.java:339)
at org.codeandmagic.android.gauge.GaugeView.init(GaugeView.java:295)
at org.codeandmagic.android.gauge.GaugeView.<init>(GaugeView.java:174)
at org.codeandmagic.android.gauge.GaugeView.<init>(GaugeView.java:182)
at gaugeviewrapper.gaugeViewWrapper._initialize(gaugeViewWrapper.java:54)
... 26 more
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
How to fix this error? DROPBOX link is also not working.
Thanks a lot