I’m trying to get names form a user using an editext object, now to get all three names from a user, should i use three editext objects or is ther a way to split an editext object to take three separate text inputs? Later i pass the data to anothe function which will print it out.
Share
Take a single EditText
Input the name like this –> Kumar Vivek Mitra
Then store it in a String.
String name = "Kumar Vivek Mitra";Use split() method.
String[] temp = name.split(" "); // SPLIT ON BASIS OF SPACEYou have all the 3 portion of name separated
System.out.println("First Name: "+temp[0]);System.out.println("Middle Name: "+temp[1]);System.out.println("Last Name: "+temp[2]);