B brentc Newbie Apr 8, 2022 #1 The following Java code: if (txtEmail.toString().indexOf('@' , 0) == -1) { showSnackbar("Test Invalid Email"); } It executes showSnackbar when there IS an @ in the txtEmail input field.. Why? Thank you anyone for your help.
The following Java code: if (txtEmail.toString().indexOf('@' , 0) == -1) { showSnackbar("Test Invalid Email"); } It executes showSnackbar when there IS an @ in the txtEmail input field.. Why? Thank you anyone for your help.
B brentc Newbie Apr 11, 2022 #3 If I do this: if ("Test@ String".indexOf("@" ) == -1) { showSnackbar("Invalid Email"); } showSnackbar() does not get executed. It works OK. So...It is the txtEmail.toString that is causing the problem. Could it be the Java compiler's fault??
If I do this: if ("Test@ String".indexOf("@" ) == -1) { showSnackbar("Invalid Email"); } showSnackbar() does not get executed. It works OK. So...It is the txtEmail.toString that is causing the problem. Could it be the Java compiler's fault??
B brentc Newbie Apr 11, 2022 #5 I do this: txtEmail = findViewById(R.id.txtEmail); and the value of txtEmail does not get transfered.. Why not?
I do this: txtEmail = findViewById(R.id.txtEmail); and the value of txtEmail does not get transfered.. Why not?
B brentc Newbie Apr 11, 2022 #6 Ok here is the correct code: if (txtEmail.getText().toString().indexOf('@' , 0) == -1) { showSnackbar("Test Invalid Email"); }
Ok here is the correct code: if (txtEmail.getText().toString().indexOf('@' , 0) == -1) { showSnackbar("Test Invalid Email"); }