Bug? No Activity.AddMenuItem after CallSub from Service

Status
Not open for further replies.

chrjak

Active Member
Licensed User
Longtime User
Hey

I call a Download Service in Activity_Create.
B4X:
Sub Activity_Create(FirstTime As Boolean)
    ProgressDialogShow2("Loading", False)
    UniversalDownload.url = "http[...]"
    UniversalDownload.Target = File.OpenOutput(File.DirInternal, "file", False)
    UniversalDownload.CallSubInModuleWhenFinished = Array(Me,Me)
    UniversalDownload.CallSubWhenFinished = Array As String("Down_Success", "Down_Failed")
    StartService(Downloader)
End Sub

After Download has been completed the Subs will be called by CallSubDelayed

B4X:
Sub Down_Success
    Dim Text As String
    Try
    Text = File.ReadString(File.DirInternal, "file")
    Catch
    End Try
    If Not(Text = "") Then
        Activity.AddMenuItem3("A1", "a1", LoadBitmap(File.DirAssets, "image.jpg"), True)
    End If
    Activity.LoadLayout("s")
    Activity.AddMenuItem3("In", "in", LoadBitmap(File.DirAssets, "in.png"),True)
    FollowingSub
End Sub

Results in everything correctly loaded but not showing any menu items. Adding the Menuitems in Activity_Create does add them.

CallSub instead of CallSubDelayed does not work. Activity.Invalidate neither

Where is the problem?
 

chrjak

Active Member
Licensed User
Longtime User
I just noticed that clicking the Menu Button after everything got loaded (Which is a long tap on the back key when using the Galaxy S7 Edge) shows all MenuItems in the ActionBar... Why that?
 

chrjak

Active Member
Licensed User
Longtime User
Also i think it is probably not because of the app being busy. a timer being set after all was completed and ticking at 5000 ms once fires activity.openmenu and activity.invalidate and does not do any changes
 

chrjak

Active Member
Licensed User
Longtime User
This is just crazy. My Galaxy S4 running 5.0.1 shows the menus items when adding openmenu at the end of all loading processes. no timer needed - invalidate does not work

An emulator running 5.1, 4.4, 6.0 does not show anything

s7 is running on 7.0
 
Status
Not open for further replies.
Top