Search code examples
androideclipseaccount

How to make sure the user type "@yahoo" or"@gmail" in an edit text?


How to make sure the user type "@yahoo" or"@gmail" in an edit text(email) and intent the information to the next page. What I want to do is: make a page for the user to open a fake account and put in all the information and then, intent all the information to the next page. Make the user feels like he/she had opened an account. And now my question is: how to confirm that the user had type in "xxx@xxx.com" in the edit text to prevent he/she knows it's fake. Any kinds of solutions will help.


Solution

  • you can do this by checking "yahoo" or "gmail" or ... in the string you get from the edit text like this:

     if (strMessage.contains("@gmail.com") || strMessage.contains("@yahoo.com"){
    //Do whatever you want.
    }