Android Question CustomListView / AddHandleActionEvent / TabHostExtras

Declan

Well-Known Member
Licensed User
Longtime User
This is a simple "Diary" app and I will write any text entered into the EditText to a SQLite database table when the user presses the "Done" button on the keypad.
In order to do this, I must be able to read the "Value".
I can do so with:
Code:
B4X:
Sub clvEvents_ItemClick(Index As Int, Value As Object)
Log(Index & " = " & Value)
End Sub
But I must be able to read the Value from the "txtEvents_Click" event.
I tried:
Code:
B4X:
Sub txtEvents_Click(Index As Int, Value As Object)
Log("From txtEdit: " & Value)
End Sub
But this does not work.
Other problems:
When the IME keypad is displayed, the CustomListView does not scroll and the keypad covers the EditText?
Clicking on the Tabs, the current Tab does not change color to show that it is active.
I have attached the Zip file of the project.
 

Attachments

  • DiaryExample.zip
    12.8 KB · Views: 306

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. You should avoid repeating code. It is not needed and it is difficult to maintain. You can easily create one or two For loops to add all these items.

txtEvents is an EditText. You should remove the IME_HandleAction event and instead handle the EditText_EnterPressed event.
B4X:
Sub txtEvents_EnterPressed
   Dim te As EditText = Sender
   Log(te.Text)
End Sub
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
Great
1. You should avoid repeating code. It is not needed and it is difficult to maintain. You can easily create one or two For loops to add all these items.

txtEvents is an EditText. You should remove the IME_HandleAction event and instead handle the EditText_EnterPressed event.
B4X:
Sub txtEvents_EnterPressed
   Dim te As EditText = Sender
   Log(te.Text)
End Sub
Great, that works.
How can I get the Value or Index of the CustomListView that contains the EditText.

I tried a doing a loop to add items, but got into muchos mess
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
1. You should avoid repeating code. It is not needed and it is difficult to maintain. You can easily create one or two For loops to add all these items.
Cool. got this working.
But strange time format with "DateTime.TimeFormat = "hh:mm a"
Time goes from: 01:00 PM to 01:15 AM
txtEvents is an EditText. You should remove the IME_HandleAction event and instead handle the EditText_EnterPressed event.
This working great.
But need to get the Index and Value of the CustomListView that contains the EditText.
Tabs do not behave when selected. I get a line below the TabText instead of the Tab changing color to show it has focus.
New edited Code attached.
 

Attachments

  • DiaryExample.zip
    15.6 KB · Views: 285
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
It shows how to get the index.
Yes, it shows how to get the index if an item is clicked within the CLV.
I need to get the CLV index if the EditText within the CLV is clicked.
 
Upvote 0
Top