Android Question All of my click subs are no longer working!

alexwekell

Member
Licensed User
Longtime User
B4X:
Sub ImageView1_Click
Dim i As PhoneCalls
    If Label4.Text.Trim = "Police" Then
    ToastMessageShow("Please enter a country first",False)
    Else If Label4.Text.Trim = "N/A" Then
    ToastMessageShow("Sorry, no number is available",False)
    Else
StartActivity(i.Call(Label4.Text.Trim))
    End If
End Sub

Attached is one of my subs for clicking. There are six of these (all the same function and code) and none of them work now. They are under a my Main module inside of a layout called "Emergencysearch".

My activity create:

B4X:
Sub Activity_Create(FirstTime As Boolean)


If File.Exists(File.DirDefaultExternal, "place.txt") = False Then
                         
      If Msgbox2("Be warned, pressing the call button / number label in this app will IMMEDIATELY start dialing emergency services and I am not at fault if this results in any negative repercussions. Please also read the disclaimer for the full terms of this app. Are you aware of these conditions and accepting of them?", "Warning", "Yes", "", "No", Null) = DialogResponse.POSITIVE Then
        File.OpenOutput(File.DirDefaultExternal, "place.txt", False)
        Else
          Activity.Finish
        End If
                         
    End If

'app start functions here


'Enable GPS
gps1.Initialize("gps1")

Activity.LoadLayout("Emergencyscreen")

    'Overflow Items
    Dim OverflowItems As List
    OverflowItems.Initialize
    OverflowItems.Add("Help/About")
    OverflowItems.Add("Disclaimer")
    OverflowItems.Add("Switch Map Style")
    OverflowItems.Add("My Coordinates")
 
    AD.Initialize("EM-Direct", "ic_icon.png", True, Colors.RGB(213,213,213), "light", False, True, True, OverflowItems, "Drawer", Activity, Me, "Main")
 
'    'If you want to use a light theme add "SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light")" to the manifest
' 
    AD.AppTitle = "EM-Direct"
' 
'    'Add the search button into the actionbar
    AD.AddAction("Search", "Search_Click", "ic_search.png") 
' 
'    'Detect if voice recogonition is possible. If it is, add a mic option
    If vr.IsSupported = True Then
    AD.AddAction("Voice Search", "Voice_Click", "ic_action_mic.png")
    End If
 
    'Load Roboto Light Font
    RobotoLight = Typeface.LoadFromAssets("Roboto-Light.ttf")
 
    'Add items to nav drawer
 
    Dim ListView1 As ListView
    Dim numberslist As ListView
    Dim labeltop As Label
    Dim labelnumber As Label
    Dim c As Canvas
 
    labeltop.Initialize("")
    labelnumber.Initialize("")
 
    labeltop.Text = ("HOW-TO")
    labelnumber.Text = ("PHONE NUMBERS")
 
    labeltop.TextColor = Colors.Gray
    labelnumber.TextColor = Colors.Gray
 
    labeltop.TextSize = 15
    labelnumber.TextSize = 15
 
    labeltop.Typeface = RobotoRegular
    labelnumber.Typeface = RobotoRegular
 
    ListView1.Initialize("ListView1")
    ListView1.SingleLineLayout.Label.Typeface = RobotoLight
    ListView1.SingleLineLayout.Label.TextColor = Colors.Gray
    ListView1.AddSingleLine("CPR")
    ListView1.AddSingleLine("CPR (Infant)")
    ListView1.AddSingleLine("CPR (Dog)")
    ListView1.AddSingleLine("CPR (Cat)")
    ListView1.AddSingleLine("Recovery Position")
    ListView1.AddSingleLine("Change Tire")
 
    numberslist.Initialize("numberslist")
    numberslist.SingleLineLayout.Label.Typeface = RobotoLight
    numberslist.SingleLineLayout.Label.TextColor = Colors.Gray
    numberslist.AddSingleLine("Emergency Numbers")
 
    Dim scrolltest As ScrollView
    scrolltest.Initialize(AD.DrawerPanel.Height)
    scrolltest.Panel.Height = AD.DrawerPanel.Height
    scrolltest.Panel.Width = AD.DrawerPanel.Width
    scrolltest.FullScroll(False)
    scrolltest.ScrollPosition = 0
 
    ListView1.SingleLineLayout.ItemHeight = 50dip
    numberslist.SingleLineLayout.ItemHeight = 50dip
 
    c.Initialize(scrolltest.Panel)
    AD.DrawerPanel.AddView(scrolltest, 0, 0, AD.DrawerPanel.Width, AD.DrawerPanel.Height)
 
    scrolltest.Panel.AddView(ListView1, 0dip, 30dip, AD.DrawerPanel.Width, 304dip)
    scrolltest.Panel.AddView(labeltop, 5dip, 5dip, AD.DrawerPanel.Width, 40dip)
    scrolltest.Panel.AddView(labelnumber, 5dip,ListView1.Height+39dip, AD.DrawerPanel.Width, 40dip)
    scrolltest.Panel.AddView(numberslist, 0dip,ListView1.Height+64dip, AD.DrawerPanel.Width, 50dip)
 
    'scrolltest.Panel.Height = AD.DrawerPanel.Height
    Dim b As Button
    b.Initialize("")
    c.DrawLine(0, 30dip, AD.DrawerPanel.Width, 30dip, Colors.Gray, 1dip)
    c.DrawLine(0, ListView1.Height+64dip, AD.DrawerPanel.Width, ListView1.Height+64dip, Colors.Gray, 1dip)
 
    'If you are using the Navigation Drawer you will need to add your views to AD.pContent rather than Activity
    'In this example I make another panel to add everything to. This will save typing time in large projects
    Dim Activ As Panel
    Activ.Initialize("")
    AD.pContent.AddView(Activ, 0, 0, 100%x, 100%y)
    Activ.SendToBack
 
    Dim lText As Label
    lText.Initialize("")
    lText.Color = Colors.White
    lText.Text = CRLF & "  Welcome to" & CRLF & "  ActionDrawer"
    lText.TextSize = 28
    'Activ.AddView(lText, 0, 0, 100%x, 100%y)
 

    'Create Cards and set all labels to use Roboto Light font
    SetNinePatchDrawable(Label1, "label_bg")
    Label1.Typeface = RobotoLight
 
    SetNinePatchDrawable(Label2, "label_bg")
    Label2.Typeface = RobotoLight
 
    SetNinePatchDrawable(Label3, "label_bg")
    Label3.Typeface = RobotoLight
 
    SetNinePatchDrawable(Label4, "label_bg")
    Label4.Typeface = RobotoLight
 
    Label5.Typeface = RobotoLight
 
    If GetDevicePhysicalSize > 6 Then
    coordinateslabel.Text = "Coordinates - LAT: " & coorlat & " " & "LONG: " & coorlng
    End If

  MapPanel.Initialize("")

  If GetDevicePhysicalSize > 6 Then
  AD.pContent.AddView(MapPanel, 7.5%x, 16%y, 85%x, 27%y)
  Else
  AD.pContent.AddView(MapPanel, 7.5%x, 13%y, 85%x, 27%y)
  End If

  ' Activity.AddView(
  If mFragment.IsGooglePlayServicesAvailable = False Then
      ToastMessageShow("Google Play services not available.", True)
  Else
      mFragment.Initialize("Map", MapPanel)
  End If

End Sub
 

Attachments

  • laaa.JPG
    laaa.JPG
    40.9 KB · Views: 172
Last edited:
Top