Description
The good thing about check boxes or radio buttons is that they have a method that lets you know if they are selected .isChecked() . With this method, we can easily know if they were pressed or not. Now the topic is: What if I want to achieve this with text ?
Attached photo of my layout
Problem:
As you can see in the image, my clock type layout gives the option to choose whether the time to select is going to be AM or PM . These two are text views. What I would like to achieve is that when I touch a number (representing the hours of the day), the app detects if "am" or "pm" was selected and transforms said number to its equivalent.
Example:
If the user taps "PM" and then taps the number 1, the app will return "13:00" representing 1 pm.
How do I do it?
Thank you for reading!
You can add an onclick event to each textView and store in a variable a boolean value that represents the textView that was clicked.
Something like that: