Android Question views for labels and spinners

Subatanx86

Member
Licensed User
I'm using the below code for an Edit Text field and that works fine. Is there something like Input Type for content stored in a label or spinner?

edtEvent.InputType = edtEvent.INPUT_TYPE_TEXT
 

LucaMs

Expert
Licensed User
Longtime User
Labels and Spinners are not views for text input.



SQLite has nothing to do with your question; you can edit the thread title:
upload_2019-3-10_6-45-36.png
 
Upvote 0

Subatanx86

Member
Licensed User
I changed the thread title, but I'm not sure how to ask the question. I want to be able to save text from a label and spinner.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Upvote 0

Subatanx86

Member
Licensed User
Right now I'm using the below code. I would prefer for edtIn and edtOut to be labels instead of edit text. Labels do not work with InputType. I'm trying to find something that does.

If FirstTime Then
SQL.Initialize(File.DirInternal, "vet.db", True)
End If
Activity.LoadLayout("Veteran")
pnl1.Visible = True
pnl2.Visible = False

Dim m As Map
m.Initialize
m.Put("ID", DBUtils.DB_TEXT)
m.Put("Event", DBUtils.DB_TEXT)
m.Put("First", DBUtils.DB_TEXT)
m.Put("Last", DBUtils.DB_TEXT)
m.Put("Rank", DBUtils.DB_TEXT)
m.Put("CheckIn", DBUtils.DB_TEXT)
m.Put("CheckOut", DBUtils.DB_TEXT)
DBUtils.CreateTable(SQL, "Vet", m, "ID")



edtEvent.InputType = edtEvent.INPUT_TYPE_TEXT
edtFirst.InputType = edtFirst.INPUT_TYPE_NONE
edtLast.InputType = edtLast.INPUT_TYPE_NONE
edtRank.InputType = edtRank.INPUT_TYPE_NONE
edtIn.InputType = edtIn.INPUT_TYPE_TEXT
edtOut.InputType = edtOut.INPUT_TYPE_TEXT
 
Upvote 0

emexes

Expert
Licensed User
I want to be able to save text from a label


maybe this?

B4X:
Dim Label1 As Label
Dim SavedLabelText As String

SavedLabelText = Label1.Text

and spinner


and this?

B4X:
Dim Spinner1 As Spinner
Dim SavedSpinnerText As String

If Spinner1.SelectedIndex <> -1 Then
    SavedSpinnerText = Spinner1.SelectedItem
Else
    SavedSpinnerText = "Nothing selected (yet)"
End If


edit: I wrote this before the above DB posts appeared, but I'll leave it here just in case there's still something of use
 
Last edited:
Upvote 0

emexes

Expert
Licensed User
B4X:
edtIn.InputType = edtIn.INPUT_TYPE_TEXT
edtOut.InputType = edtOut.INPUT_TYPE_TEXT

if edtIn and edtOut are Labels rather than EditTexts, then they are already INPUT_TYPE_TEXT (ie, String) and you don't need to set any input restrictions.

But because they are Labels, the user cannot change the text. You can, though: you can both read (save?) and write the text of a Label using Label.Text.
 
Upvote 0
Top