Android Question menu button is missing when i install the app on phone

Makumbi

Well-Known Member
Licensed User
Please help when i run the app in debug all is well this button . even when i click on the button show menu the menu come but after installing on the actuall device that button disappear and even when i try to click the show menu button it does not function

here is the code for the show menu button

B4X:
Sub Showmenu_Click
    
    Activity.OpenMenu
End Sub

here is the missing button image

Screenshot_1586848512.png
 

Makumbi

Well-Known Member
Licensed User
Can you post the code in Activity_Create?
Here is the code Erel
B4X:
#Region  Project Attributes
    #ApplicationLabel: SmisKabojja
    #VersionCode: 30
    #VersionName: SmisKabojja
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #BridgeLogger: True
 
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region
#AdditionalJar: com.android.support:support-v4

'Activity module
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    'Dim SQL1 As SQL
    Dim cursor1 As Cursor
    Private smiley As Bitmap
    'Dim scvPersons As ScrollView
    Type RowCol (Row As Int, Col As Int)
    'Private xui As XUI
 
 
End Sub

Sub Globals
    'Dim badge As ShortcutBadger
    Private badger1 As Badger
    Dim cart As Bitmap
    'Dim ActionMode As JavaObject
    Dim lbl As Label
    Private TabStrip1 As TabStrip
    Private Page3ListView1 As ListView
    Private Parentprof As ListView
    Private Parentaccount As ListView
    Private Classteachers As ListView
    Private Newstudent As ListView
    Private Homeworklist As ListView
    Private Helpabout As ListView
    Private mustread As ListView
    Private combook As ListView
    Private noticeboardshow As ListView
    Private B4XPageIndicator1 As B4XPageIndicator
'    Private Drawer As B4XDrawer
    Private returnValue As Boolean
    Private Panel1 As Panel
    'Dim cs As CSBuilder
    'Private CustomListView1 As CustomListView
    'Private pnlTop As B4XView
    'Private lblHeader As B4XView
    'Private CLVHeader1 As CLVHeader
    'Private ImageView1 As B4XView
    'Dim Froms As EditText
    Private badger1 As Badger
    Dim showmenu As Button
    'Dim bkact As String
    'Dim sm As SlideMenu
    'Dim LVDb As ListView
 
    'Private BBScrollingLabel1 As BBScrollingLabel
    'Private TextEngine As BCTextEngine
    Private B4XTable1 As B4XTable

    'Private xui As XUI
    Dim DATAs As List
    Dim CCode As EditText
    Dim Phone As EditText
    Dim Emails As MaskedEditText
 
    Dim Dialog As JavaObject
    Private xui As XUI

'    Dim Table1 As Table
  '  Dim label2 As EditText
 
    'Private btnAdd, btnEdit, btnFilter, btnSetFilter As Button
    Private lblSelectedItem As Label
    Private label1 As Label
    Private label2 As Label
 
    'Dim imageview1 As ImageView
    Private male As RadioButton
    Private female As RadioButton
    Private Sponsor As RadioButton
    Private Other As RadioButton
    ' used in ExecuteHTML

End Sub



Sub Activity_Create(FirstTime As Boolean)
 
    badger1.Initialize
    Dim bc As BitmapCreator
    bc.Initialize(10, 10)
    If FirstTime Then
        smiley = LoadBitmapResize(File.DirAssets, "smiley.png", 24dip, 24dip, False)
    End If
 
 
    cursor1 = Starter.SQL1.ExecQuery("SELECT ID FROM Register")
    If cursor1.RowCount > 0 Then
        For i = 0 To cursor1.RowCount - 1
            cursor1.Position = i
     
            'StartActivity(Main)
     
            Dim intCount As Int
            intCount = Starter.SQL1.ExecQuerySingleResult("SELECT count(Id) as Id FROM Eventsinfo WHERE Tcode NOT LIKE '%READ%';")
         
            If intCount > 0 Then
                Dim ms As Int = intCount
            Else
                Dim ms As Int = 0.5
            End If
            Log(ms)
            If ms = 0.5 Then
                'badger1.SetBadge(btnAdd, ms)
            Else
                'badger1.SetBadge(btnAdd, ms)
            End If
         
 
        Next
     
    Else
        'Activity.LoadLayout("Registerdata")
        StartActivity(Registerdata)
    End If
 
 
    'Sleep(0)
    male.Initialize("male")
    female.Initialize("female")
    Sponsor.Initialize("sponsor")
    Other.Initialize("Other")
    lblSelectedItem.Initialize("lblSelectedItem")
    Emails.Initialize("Emails")
    CCode.Initialize("CCode")
    Phone.Initialize("Phone")
 
 
    'ProgressDialogShow2("Processing Please Wait...",False)
    Sleep(0)
    Dim hold As String
    Dim rst As ResumableSub = checkuser(hold)
    Wait For(rst) Complete (Result As String)
    Log("result: " & Result)
    Log(hold)
    hold=Result
    Log("after sum")
    If hold=Null Then
        'MsgboxAsync("Poor Internet Connectivity Please  Connect Again" ,"SMIS")
        'Sleep(50)
        'Activity.Finish
        Return
    End If
                If hold="Expired" Then
                    Return
                    Else
        If hold="Inactive" Then
            Return
            End If
                End If
 
    If hold="Active" Then
        'StartActivity(Failedlogin)
        ProgressDialogShow2("Validating User Please Wait...",False)
        Sleep(30)
        Activity.LoadLayout("1")
        Activity.Title="KABOJJA JUNIOR APP"
        TabStrip1.LoadLayout("Page1", "Parent Profile " & Chr(0xF2BC)& " : ")
        'TabStrip1.LoadLayout("Page1", cs.Initialize.Typeface(Typeface.FONTAWESOME).Size(22).VerticalAlign(3dip).Append(Chr(0xF007)).PopAll.Append("Parent Profile").PopAll)
        TabStrip1.LoadLayout("Page2", "Accounts " & Chr(0xF19C)& " : ")
        TabStrip1.LoadLayout("Page3", "Academics " & Chr(0xF19D)& " : ")
        TabStrip1.LoadLayout("Page4", "Communication Book " & ": " & Chr(0xF1D7)& " : ")
        TabStrip1.LoadLayout("noticeboardlist", "Notice Board " & Chr(0xF2BC)&  ": ")
        TabStrip1.LoadLayout("Page5", "New Admissions "& Chr(0xF0C0)& ": ")
        TabStrip1.LoadLayout("Page6", "Home work " & Chr(0xF019)& " : ")
        TabStrip1.LoadLayout("Page7", "Get Class Teacher Details " & Chr(0xF007)& " : ")
        TabStrip1.LoadLayout("Page8", "Must Read " & Chr(0xF071)& " : ")
        TabStrip1.LoadLayout("Page9", "Help About App "& Chr(0xF095)& " : ")
     
 
        'For i = 1 To 3
        'Page3ListView1.AddSingleLine($"Item ${i}"$)
     
        Page3ListView1.AddSingleLine($"Current Performance"$)
        'Page3ListView1.AddTwoLines("Item #" & 2, "This is the second line.")
        Page3ListView1.AddSingleLine($"Past Performance"$)
        Page3ListView1.AddSingleLine($"Performance Curves"$)
        Page3ListView1.AddSingleLine($"Compare Performance Record"$)
 
 
        Parentprof.AddSingleLine($"Parent Profile"$)
        Parentprof.AddSingleLine($"Change Number"$)
 
        combook.AddSingleLine($"Send Message To School"$)
        noticeboardshow.AddSingleLine($"Notice Board"$)
        Parentaccount.AddSingleLine($"Check Balance"$)
     
        Parentaccount.AddSingleLine($"Account Statement"$)
        Helpabout.AddSingleLine($"Help About App"$)
        mustread.AddSingleLine($"Must Read"$)
        'Parentprof.AddSingleLine($"Change Number"$)
        'Next
 
        'For k = 1 To 2
        'ListView1.AddSingleLine($"Item ${k}"$)
        Newstudent.AddSingleLine($"New Student Applications"$)
        Classteachers.AddSingleLine($"Get Class teacher Contacts"$)
        'ListView1.AddSingleLine($"Send Homework To Your Email Address"$)
     
        Homeworklist.AddSingleLine($"Download Homework"$)
        Homeworklist.AddSingleLine($"Send work To Your Email"$)
 
        For Each lbl2 As B4XView In GetAllTabLabels(TabStrip1)
            Dim Width, Height As Int
            Dim jo As JavaObject = lbl2
            Do While True
                Width = jo.RunMethod("getMeasuredWidth", Null)
                Height = jo.RunMethod("getMeasuredHeight", Null)
                If Width > 0 And Height > 0 Then
                    Exit
                End If
                Sleep(50)
            Loop
            Dim p As Panel = xui.CreatePanel("")
            p.Tag = lbl2
            lbl2.Parent.AddView(p, 0, 0, Width, Height)
            lbl2.RemoveViewFromParent
            p.AddView(lbl2, 0, 0, Width, Height)
        Next

 
 
        'For Each lbl As Label In GetAllTabLabels(TabStrip1)
            'badger1.SetBadge(lbl, Rnd(1,2) )
        'Next
        cursor1 = Starter.SQL1.ExecQuery("SELECT phone AS Phone,Sex FROM Register")
        If cursor1.RowCount > 0 Then
            cursor1.Position =0
            Dim Phoneb As String
            Phoneb = cursor1.Getstring("Phone")
                End If
     
        Dim intCount As Int
        intCount  = Starter.SQL1.ExecQuerySingleResult2("SELECT count(Id) as Id FROM tbl_Messages WHERE INflag LIKE '%UNREAD%' and Phone = ?", Array As String(Phoneb))
  Log(intCount)

         
        If intCount > 0 Then
            Dim ms As Int = intCount
            Dim lbl As Label = GetAllTabLabels(TabStrip1).Get(3) '1 = tab #2
        '    badger1.SetBadge(lbl, Rnd(1,ms) )
            badger1.SetBadge(lbl, badger1.GetBadge(lbl) + ms)
        Else
            'Dim ms As Int = 0.5
            'badger1.SetBadge(lbl, Rnd(1,ms) )
        End If
 
 
         'lbl.Visible=False
     
        For Each lbl As Label In GetAllTabLabels(TabStrip1)
            lbl.Typeface = Typeface.FONTAWESOME
        Next
 
 
        'Activity.AddMenuItem3("", "mnuEdit", LoadBitmap(File.DirAssets, "download.png"), True)
        'Activity.AddMenuItem3("", "mnuNew", LoadBitmap(File.DirAssets, "download.png"), True)
        'Activity.AddMenuItem3("", "mnuUndo", LoadBitmap(File.DirAssets, "download.png"), True)
        '    ShowTable
        Activity.AddMenuItem("Parent Profile", "mnu1")
        Activity.AddMenuItem("Accounts", "mnu2")
        Activity.AddMenuItem("Academics", "mnu3")
        Activity.AddMenuItem("Communication Book", "mnu4")
        Activity.AddMenuItem("Notice Board", "mnu5")
        Activity.AddMenuItem("New Admissions", "mnu6")
        Activity.AddMenuItem("Home work Download", "mnu7")
        Activity.AddMenuItem("Get Class Teacher Details", "mnu8")
        Activity.AddMenuItem("Must Read", "mnu9")
        Activity.AddMenuItem("Help", "mnu10")
        Activity.OpenMenu
     
     
             


        'TextEngine.Initialize(Activity) 'change to Form.RootPane in B4J or Page.RootPanel in B4i
        'BBScrollingLabel1.TextEngine = TextEngine
                'KJSNew.Text = $"[b][u]BBScrollingLabel[/u][/b]:More information: ghghghghgghghghghgh..............."$
        'BBScrollingLabel1.Text= $"[b][u]BBScrollingLabel[/u][/b]:Wait While : Loading Kabojja Junior App"$
        Dim holdnt As String
        Dim rstnt As ResumableSub = ValidateReg(holdnt)
        Wait For(rstnt) Complete (Result As String)
             
        Dim holdn As String
        Dim rstn As ResumableSub = Notify(holdn)
        Wait For(rstn) Complete (Result As String)
             
        '    Processevents
     
        ' Load Emails
        Dim holdnbemail As String
        Dim rstnbemail As ResumableSub = Loademail(holdnbemail)
        Wait For(rstnbemail) Complete (Result As String)

        'Dim w As String
        'Dim rstn As ResumableSub = Processevents(w)
        'Wait For(rstn) Complete (Result As String)
             
 
        Dim holdna As String
        Dim rstna As ResumableSub = accountprocess(holdna)
        Wait For(rstna) Complete (Result As String)
     
        Dim holdnb As String
        Dim rstnb As ResumableSub = Loadterms(holdnb)
        Wait For(rstnb) Complete (Result As String)
     
 
     
        Dim holdnba As String
        Dim rstnba As ResumableSub = Loadanouncements(holdnba)
        Wait For(rstnba) Complete (Result As String)
     
        ProgressDialogHide
        ProgressDialogShow2("Processing the Finance data Please Wait...",False)
        Sleep(10)
        'Sleep(100)
     
        'Processacademics
             
        Dim holdnact As String
        Dim rstnact As ResumableSub = LoadStudents(holdnact)
        Wait For(rstnact) Complete (Result As String)
        ProgressDialogHide
        Return
     
         
    End If
 

 

End Sub


B4X:
'This is a modified version of this sub that also checks for panels
Public Sub GetAllTabLabels (tabstrip As TabStrip) As List
    Dim jo As JavaObject = tabstrip
    Dim r As Reflector
    r.Target = jo.GetField("tabStrip")
    Dim tc As Panel = r.GetField("tabsContainer")
    Dim res As List
    res.Initialize
    For Each v As View In tc
        If v Is Label Then res.Add(v)
        If v.Tag Is Label Then res.Add(v.Tag)
    Next
    Return res
End Sub

my manifest editor

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:usesCleartextTraffic, "true")
SetApplicationAttribute(android:allowBackup, "false")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
    SetActivityAttribute(SendsmschatV2, android:windowSoftInputMode, adjustPan|stateHidden)
CreateResourceFromFile(Macro, Themes.DarkTheme)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
CreateResourceFromFile(Macro, Core.NetworkClearText)
AddPermission(com.majeur.launcher.permission.UPDATE_BADGE)
AddPermission(com.sec.android.provider.badge.permission.READ)
AddPermission(com.sec.android.provider.badge.permission.WRITE)
AddPermission(com.htc.launcher.permission.READ_SETTINGS)
AddPermission(com.htc.launcher.permission.UPDATE_SHORTCUT)
AddPermission(com.anddoes.launcher.permission.UPDATE_COUNT)
AddPermission(com.majeur.launcher.permission.UPDATE_BADGE)
AddPermission(com.huawei.launcher3.permission.READ_SETTINGS)
AddPermission(com.huawei.launcher3.permission.WRITE_SETTINGS)
AddPermission(com.huawei.launcher2.permission.READ_SETTINGS)
AddPermission(com.huawei.launcher2.permission.READ_SETTINGS)
AddPermission(com.huawei.android.launcher.permission.WRITE_SETTINGS)
AddPermission(com.huawei.android.launcher.permission.READ_SETTINGS)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(com.sonyericsson.home.permission.BROADCAST_BADGE)
AddPermission(com.anddoes.launcher.permission.UPDATE_COUNT)

AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <files-path name="name" path="shared" />
)

 

CreateResource(values, colors.xml,
<resources>
    <color name="actionbar">#0098FF</color>
    <color name="statusbar">#ff006db3</color>
    <color name="textColorPrimary">#ffffffff</color>
    <color name="navigationBar">#ff006db3</color>
</resources>
)
CreateResource(values-v20, theme.xml,
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Material.Light">
         <item name="android:colorPrimary">@color/actionbar</item>
         <item name="android:colorPrimaryDark">@color/statusbar</item>
         <item name="android:textColorPrimary">@color/textColorPrimary</item>
         <item name="android:navigationBarColor">@color/navigationBar</item>
    </style>
</resources>
)
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Please help how can i arrange them now thanks
You already got the CORRECT answer.

You need to make the calls to Activity.AddMenuItem before any call to Sleep or Wait For.
Why you are totally ignoring the suggestion?

Did you understand the written words?
 
Last edited:
Upvote 0
Top