A Arturs Member Licensed User Longtime User Nov 3, 2015 #1 Hi How to change Seekbar value from service module (refresh value of seekbar) ? Regards Artur
Erel B4X founder Staff member Licensed User Longtime User Nov 3, 2015 #2 Use CallSub or CallSubDelayed to call a sub in the Activity that will change the value. Upvote 0
A Arturs Member Licensed User Longtime User Nov 3, 2015 #3 I thought that I should use it. CallSubDelayed needs the following parameters:Component as Object, Sub As String My Sub is Sub Seek_ValueChanged (Value As Int, UserChanged As Boolean) How to pass parameters: Value and UserChanged ? something I do not understand Upvote 0
I thought that I should use it. CallSubDelayed needs the following parameters:Component as Object, Sub As String My Sub is Sub Seek_ValueChanged (Value As Int, UserChanged As Boolean) How to pass parameters: Value and UserChanged ? something I do not understand
DonManfred Expert Licensed User Longtime User Nov 3, 2015 #4 Create a sub in your Activity. for example in MAIN B4X: sub SetSeekbarValue(value As int) myseekbarname.value = value end sub And then from your Service B4X: CallSubDelayed2(Main,"SetSeekbarValue",Array as int(16)) Upvote 0
Create a sub in your Activity. for example in MAIN B4X: sub SetSeekbarValue(value As int) myseekbarname.value = value end sub And then from your Service B4X: CallSubDelayed2(Main,"SetSeekbarValue",Array as int(16))
A Arturs Member Licensed User Longtime User Nov 3, 2015 #5 I have the error : "java.lang.IllegalArgumentException: argument 1 should have type int, got int[]" in the line myseekbarname.value = value Upvote 0
I have the error : "java.lang.IllegalArgumentException: argument 1 should have type int, got int[]" in the line myseekbarname.value = value
DonManfred Expert Licensed User Longtime User Nov 3, 2015 #6 try not using an array B4X: CallSubDelayed2(Main,"SetSeekbarValue",16) Upvote 0
A Arturs Member Licensed User Longtime User Nov 3, 2015 #7 It works and simple to use I thought that I cannot pass int value because CallSubDelayed2 expects Object type. Could you explain me why we can use Int ? CallSubDelayed2 (Component As Object, Sub As String, Argument As Object) Upvote 0
It works and simple to use I thought that I cannot pass int value because CallSubDelayed2 expects Object type. Could you explain me why we can use Int ? CallSubDelayed2 (Component As Object, Sub As String, Argument As Object)
DonManfred Expert Licensed User Longtime User Nov 3, 2015 #8 int, long, String, double... ALL of them are Objects Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Nov 4, 2015 #9 As @DonManfred wrote primitive types can be treated as objects (it is called auto-boxing). Upvote 0