B4A Tutorial [B4X] Resumable subs that return values (ResumableSub) - Erel    Aug 25, 2020   (41 reactions)   tags: wait, Comm, Code, B4X, Dialog ResumableSub, Wait For wait for the resumable sub to complete then return Null from the resumable sub and set the type in...Remember that that a call to Sleep or Wait For in a resumable sub causes the code flow to return to... Sub Output: after sum 3 This is the reason why it is not possible to simply return a value. Solution Resumable subs can return a new type named ResumableSub. Other subs can use this value to wait for the sub to complete and get the desired return value. Sub Button1_Click Wait For(Sum(1, 2... B4A Code Snippet Get the path to media files returned from ContentChooser - Erel    Jul 24, 2022   (9 reactions)   tags: Adjuntar un File It is a mistake to try to get a file path from the returned resource. It will not work in most... files SubName: GetPathFromContentResult Description: Content providers such as the media gallery... GetPathFromContentResult(UriString As String) As String If UriString.StartsWith("/") Then Return UriString... As String res = Cursor1.GetString("_data") Cursor1.Close Return res End Sub In... assume that the resource returned from ContentChooser comes from the file system and if... B4J Tutorial [B4X] Resumable Subs - Sleep / Wait For - Erel    Feb 22, 2018   (50 reactions)   tags: Reference, Comm, download, Resumable Subs, Code, Wait For , the current sub is paused. This is equivalent to calling Return. Wait for a resumable sub to complete and return values from a resumable sub: https://www.b4x.com/android/forum/threads/b4x-resumable-subs-that-return-values-resumablesub.82670/ Notes & Tips - Resumable subs cannot return a value... of the code and move them to other subs that are called from the resumable sub.) - Wait For events handlers...New video tutorial: 255570732 Resumable subs is a new feature added in B4J v5.50 / B4i v4.00... B4A Code Snippet [B4X] HexToColor and ColorToHex - Erel    Feb 24, 2020   (18 reactions) Converts hex color strings to a color int value and vice versa: Private Sub ColorToHex(clr As Int) As String Dim bc As ByteConverter Return bc.HexFromBytes(bc.IntsToBytes(Array As Int(clr))) End Sub Private Sub HexToColor(Hex As String) As Int Dim bc As ByteConverter If Hex...) Then Hex = Hex.SubString(2) End If Dim ints() As Int = bc.IntsFromBytes(bc.HexToBytes(Hex)) Return ints(0) End Sub Depends on: B4A / B4J - ByteConverter, B4i - iRandomAccessFile... B4A Code Snippet [B4X] Bytes To File - Erel    May 24, 2020   (19 reactions)   tags: Image, Share Images, Bytes, B4X, B4X Bytes To File, , bitmap to byte and revert This code is no longer needed. Use File.WriteBytes / ReadBytes.
Write an array of bytes to a file and read a file into an array of bytes.
Sub BytesToFile (Dir As String, FileName As String, Data..., 0, Data.Length)
out.Close
End Sub
Sub FileToBytes (Dir As String, FileName As String) As Byte()
Return Bit.InputStreamToBytes(File.OpenInput(Dir, FileName))
End Sub
Note that you can convert... B4J Code Snippet Resumable Subs (wait for / sleep) in server handlers - Erel    Feb 16, 2020   (15 reactions) a page and returns it as the response: Sub Handle(req As ServletRequest, resp As ServletResponse) Download(resp) StartMessageLoop '<--- End Sub Sub Download (resp As ServletResponse...Resumable subs can only work when there is a message queue. By default, server handlers end when the Handle sub is completed. They do not create a message loop. If you want to wait for an event then... j.Release StopMessageLoop '<---- End Sub The Handle sub cannot be a resumable sub... B4A Tutorial Accessing third party Jar with #Additionaljar and JavaObject - Picasso - Erel    Jan 19, 2026   (26 reactions)   tags: Lib, use jar in b4a, JAR ("with", Array(GetContext)) End Sub Sub GetContext As JavaObject Return GetBA.GetField... service directly. Sub GetContext As JavaObject Return GetBA.GetField("context") End Sub...("class ".Length) jo.InitializeStatic(cls) Return jo.GetFieldJO("processBA") End Sub...).RunMethod("with", Array(GetContext)) End Sub Now we will implement the above Java code... the event cannot be raised (activity is paused for example). In this case we return Null. The event sub... B4A Tutorial Intent Filters - Intercepting SMS messages in the background - Erel    Jan 13, 2023   (14 reactions) 'Parses an SMS intent and returns an array of messages Sub ParseSmsIntent (in As Intent) As Message...") Next End If Return messages End Sub Update 2018: Static intent filters will cause... SmsInterceptor objects from the Phone library also use dynamic registration to listen for common intents.... This will prevent the process from being killed. However this will also add an ongoing notification... the intent action. If it fits then the messages will be parsed from the intent. This is done with the help... B4A Library [B4X][LOA] ListOfArrays - lightweight, powerful and flexible collection - Erel    Mar 18, 2026   (26 reactions) by column value. Conversion to and from string arrays, mainly useful for CSV. Shallow and deep...ListOfArrays (LOA) is a simple list where each item is an array of objects, and each array..., including UI elements and class instances. Lightweight conversion between List and ListOfArrays with almost no overhead. Useful for datasets ranging from a few rows to hundreds of thousands of rows... matching is now case insensitive. New methods: ToListOfMaps and LOAUtils.CreateFromListOfMaps. v0.92... B4J Question I'm confused by CallSub... - Erel (first post)    Jul 29, 2019 The return is an array of byte arrays, which appears to be passed by value,
When you return an array from a sub it is not copied. You return a reference to the same array (the reference is passed by value but it is less important).
I don't see any problem with your code, assuming that the indirect calling is indeed required.... Page: 1   2   3   4   5   6   7   |