I use ABPlugin from @alwaysbusy for my application. Its an awesome Lib btw!
One Plugin has to download something and parse the response to the Main Application.
because i need to use
to wait for the response, the Run sub has to be a ResumableSub to parse the response.
But i think the lib doesnt support it?
In my main application i try to get the map with
but i get the error:
how can i make this work?
One Plugin has to download something and parse the response to the Main Application.
because i need to use
B4X:
Wait For (j) JobDone(j As HttpJob)
B4X:
public Sub Run(Tag As String, Params As Map) As ResumableSub
Select Case Tag
Case "tick"
Dim j As HttpJob
j.Initialize("job",Me)
j.Download("http://api.apixu.com/v1/current.json")
Wait For (j) JobDone(j As HttpJob)
Dim parser As JSONParser
parser.Initialize(j.GetString)
Dim root As Map = parser.NextObject
Dim current As Map = root.Get("current")
Dim condition As Map = current.Get("condition")
Dim icon As String = condition.Get("icon")
Dim temp As String = current.Get("temp_c")
Return CreateMap("URLicon":Array As Object("http:"&icon))
End Select
Return ""
End Sub
But i think the lib doesnt support it?
In my main application i try to get the map with
B4X:
Dim rs As ResumableSub = plugin.RunPlugin("test"), "start", CreateMap("":Null))
Wait For(rs) Complete (Result As Map)
For Each k As String In Result.Keys
next
B4X:
java.lang.ClassCastException: anywheresoftware.b4a.keywords.Common$ResumableSubWrapper cannot be cast to anywheresoftware.b4a.BA$ResumableSub
how can i make this work?
Last edited: