-1

In my activity, I get user input with editText, checkbox, image and dropdown menu and save these informations inside Firebase.

I need a way to validate the fields. For example, if editTexts are empty, I'd like to show an alert to remember the user to insert that data. Same thing if no dropdown element is selected.

I tried with alert dialog but as I can see they dont stop the app's execution, so when the user click save to send data, the alert shows but it disappers instantly and the app goes on...

How can I archieve the validation I need ?

Bruno
  • 3,872
  • 4
  • 20
  • 37
C-Gian
  • 62
  • 2
  • 19

1 Answers1

0

A best practice to do this is to disable the Validate button until your form is valid. It implies to indicates the user which fields are mandatory, with red asterisk for example. The consequence is to have a listener on all fields to launch the validation method or to use some 'form validation' libraries

Bruno
  • 3,872
  • 4
  • 20
  • 37