Skip to main content
Question Protected by Jamal
deleted 1 character in body; edited title
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

A simple method to validate Validating multiple EditText fields in Java/Android

EnviornmentEnvironment: Android Android Studio 1.0

Code:

The above function gets called on the SubmitSubmit button and is further processed to the server.

A simple method to validate multiple EditText fields in Java/Android

Enviornment: Android Studio 1.0

Code:

The above function gets called on Submit button and is further processed to the server.

Validating multiple EditText fields

Environment: Android Studio 1.0

The above function gets called on the Submit button and is further processed to the server.

markdown fixes + minor grammar
Source Link
janos
  • 111.7k
  • 15
  • 152
  • 391

I am using the following method to validate if user has given any input or left an EditTextEditText empty,. I am concerned about the returnreturn statement in particular, because my IDE keeps complaining about it.

The return type of the method is voidvoid, because I dontdon't want any return from this, I only want to stop execution if validation fails. However my IDE complains about the last return statement in the last if-else construct. I am wondering if I should infactin fact change the return type from voidvoid to booleanboolean and maintain an array value for each form field. Later on I can check if all the array values are true or not.

The above function gets called on SubmitSubmit button and is further processed to the server.

I am using the following method to validate if user has given any input or left an EditText empty, I am concerned about the return statement in particular, because my IDE keeps complaining about it

The return type of the method is void, because I dont want any return from this, I only want to stop execution if validation fails. However my IDE complains about the last return statement in the last if-else construct. I am wondering if I should infact change the return type from void to boolean and maintain an array value for each form field. Later on I can check if all the array values are true or not.

The above function gets called on Submit button and is further processed to the server.

I am using the following method to validate if user has given any input or left an EditText empty. I am concerned about the return statement in particular, because my IDE keeps complaining about it.

The return type of the method is void, because I don't want any return from this, I only want to stop execution if validation fails. However my IDE complains about the last return statement in the last if-else construct. I am wondering if I should in fact change the return type from void to boolean and maintain an array value for each form field. Later on I can check if all the array values are true or not.

The above function gets called on Submit button and is further processed to the server.

added 111 characters in body
Source Link
Junaid
  • 217
  • 1
  • 4
  • 10

The return type of the method is void, because I dont want any return from this, I only want to stop execution if validation fails. However my IDE complains about the last return statement in the last if-else construct. I am wondering if I should infact change the return type from void to boolean and maintain an array value for each form field. Later on I can check if all the array values are true or not.

The return type of the method is void, because I dont want any return from this, I only want to stop execution if validation fails. However my IDE complains about the last return statement in the last if-else construct. I am wondering if I should infact change the return type from void to boolean.

The return type of the method is void, because I dont want any return from this, I only want to stop execution if validation fails. However my IDE complains about the last return statement in the last if-else construct. I am wondering if I should infact change the return type from void to boolean and maintain an array value for each form field. Later on I can check if all the array values are true or not.

Source Link
Junaid
  • 217
  • 1
  • 4
  • 10
Loading