if ("Submit".equals(cmd)) { //Process the password.
String UserNameInput=UserName.getText();
///////////////////////////////ERROR Pin when printed shows error/////////////////////////////
char[] PinInput = PinField.getPassword();
String pinInput=PinInput.toString();
//for debugging , print PinInput , but it prints garbage
System.out.println("Pin entered is "+PinInput);
//pinInput has garabage instead of the Pin that was entered
//so the function isPasswordCorrect fails to verify UserName & Pin
if (isPasswordCorrect(UserNameInput,pinInput))
{
//some tasks
}
}
boolean isPasswordCorrect(String Username,String Pin)
{
//verify username & pin
}
I need to convert the PinInput from character array to String, so that I can use the function isPasswordCorrect() . When I use toString() method , it produces garbage value , what should I do to convert the value of PinInput to String ?
Look at the String API, there is a constructor that accepts a char array.