My App Code:
#ApplicationLabel: AreaCalc
#VersionCode:24
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: True
#BridgeLogger: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules. Public by default.SSS
Public TotalArea As Double
Type Rooms(Width As Double, Length As Double, Area As Double)
Public lstRooms As List
Public RoomIndex = 1 As Int
End Sub
Sub Globals
'Variables always Private in this sub SSS
Private lblRoom, lblFind, lblArea, lblTotalArea, lblRoomNumber As Label
Private edtLen, edtWidth As EditText
Private btnCalc As Button
'Private pnlBitmap As Panel
Private ltvRooms As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Room1_")
lstRooms.Initialize
ltvRooms.SingleLineLayout.Label.TextSize = 18
ltvRooms.SingleLineLayout.ItemHeight = 30dip
NewRoom
' pnlBitmap.Initialize ("")
' Activity.AddView (pnlBitmap, 0%x, 270dip, 72%y, 190dip)
' Private bdwBitmap As BitmapDrawable
' bdwBitmap.Initialize(LoadBitmap(File.DirAssets, "Framing.jpg"))
' bdwBitmap.Gravity = Gravity.FILL
' pnlBitmap.Background = bdwBitmap
Log($"Today's Date $date{DateTime.Now}"$)
'Above is smart string (using $ symbols)
'Not smart
Log("Also today is " & DateUtils.GetDayOfWeekName(DateTime.Now))
'***
'Below is smart string time
Log ($"The Time $Time{DateTime.Now}"$)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub NewRoom
Private Room As Rooms
Room.Area = 0
Room.Length = 0
Room.Width = 0
lstRooms.Add(Room)
ltvRooms.AddSingleLine("Room #" & RoomIndex & " W = " & Room.Width & " L = " & Room.Length& " Area = " & NumberFormat(Room.Area, 1, 2))
RoomIndex = lstRooms.Size
lblArea.Text = " Will Display Here"
End Sub
Sub btnCalc_Click
Private Room As Rooms
Room.Width = edtWidth.Text
Room.Length = edtLen.Text
Room.Area = Room.Width * Room.Length
TotalArea = TotalArea + Room.Area
lblArea.Text = NumberFormat(Room.Area, 1, 0) & " Square Feet"
lstRooms.Set(RoomIndex - 1, Room)
UpdateRoomList
CalculateTotalArea
lblTotalArea.Text = NumberFormat(TotalArea, 1, 2) & " s.f."
End Sub
Private Sub btnNewRoom_Click
NewRoom
UpdateNewRoomScreen
UpdateRoomList
End Sub
Sub ltvRooms_ItemClick (Position As Int, Value As Object)
RoomIndex = Position + 1
UpdateRoomScreen
End Sub
Private Sub UpdateRoomScreen
Private Room As Rooms
Room = lstRooms.Get(RoomIndex - 1)
lblRoomNumber.Text = RoomIndex
If Room.Width = 0 Then
edtWidth.Text = ""
Else
edtWidth.Text = Room.Width
End If
If Room.Length = 0 Then
edtLen.Text = ""
Else
edtLen.Text = Room.Length
End If
lblArea.Text = NumberFormat(Room.Area, 1, 0) & " Square Feet"
lblTotalArea.Text = NumberFormat(TotalArea, 1, 2)
End Sub
Private Sub UpdateNewRoomScreen
lblRoomNumber.Text = RoomIndex
edtWidth.Text = ""
edtLen.Text = ""
End Sub
Private Sub UpdateRoomList
Private i As Int
ltvRooms.Clear
For i = 0 To lstRooms.Size - 1
Private Room As Rooms
Room = lstRooms.Get(i)
ltvRooms.AddSingleLine("Room #" & (i + 1) & " W = " & Room.Width & " L = " & Room.Length & " Area = " & NumberFormat(Room.Area, 1, 2))
Next
End Sub
Private Sub CalculateTotalArea
Private i As Int
TotalArea = 0
For i = 0 To lstRooms.Size - 1
Private Room As Rooms
Room = lstRooms.Get(i)
TotalArea = TotalArea + Room.Area
Log (TotalArea)
Next
End Sub
Here's the problem with the emulator, using my published app:
It should display like this: App_shot2c.png
but there is no text, and some buttons and labels don't show.
It displays like this: My App failure_cropped.png
Can some generous individual out there help me by running my app to see if it will display normally? Here's my zipped app. Thanks people!
Well, I can't seem to send the zip so the code is displayed.
P.S. The app displays properly on my Samsung S9.
Attachments
Last edited: