B4A Library My First Lib TemperatureConverter

Hello everyone

I make this Library for try How to make one

Library is very simple
Temperature conversion

B4X:
 Dim Un As TemperatureConverter
    Private Spinner1 As Spinner
    Private EditText1 As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
 
    Activity.LoadLayout("index")

Spinner1.Add("From_Celsius_to_Fahrenheit")
Spinner1.Add("From_Celsius_to_Kelvin")
Spinner1.Add("From_Fahrenheit_to_Celsius")
Spinner1.Add("From_Fahrenheit_to_Kelvin")
Spinner1.Add("From_Kelvin_to_Celsius")
Spinner1.Add("From_Kelvin_to_Fahrenheit")


End Sub
Sub Activity_Resume

End Sub
Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub Spinner1_ItemClick (Position As Int, Value As Object)

If     EditText1.Text <>"" Then
    Select Position
        Case 0
            Msgbox(Un.From_Celsius_to_Fahrenheit(EditText1.Text),"") 
        Case 1
            Msgbox(Un.From_Celsius_to_Kelvin(EditText1.Text),"") 
        Case 2
            Msgbox(Un.From_Fahrenheit_to_Celsius(EditText1.Text),"") 
        Case 3
            Msgbox(Un.From_Fahrenheit_to_Kelvin(EditText1.Text),"") 
        Case 4
            Msgbox(Un.From_Kelvin_to_Celsius(EditText1.Text),"") 
        Case 5 
            Msgbox(Un.From_Kelvin_to_Fahrenheit(EditText1.Text),"")         
          
    End Select
End If 
End Sub
 

Attachments

  • TemperatureConverter_Example.zip
    365.6 KB · Views: 178
  • TemperatureConverterLib.zip
    2.9 KB · Views: 183
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Top