I’ve made an offline currency convertor that gets the users input in the EditText section using a TextWatcher and returns the required ouptut from methods…and I”ve made it an a way that the user cannot insert a “null” value in the EditText section and then press the convert button by using euro.getText !==null for example.But I don’t know how to proceed when the user leaves some space between the input,for instance 29 50.This will make my program to crash.My question what should I use to check for an input with space in order to avoid a program crash?Thank you.
I’ve made an offline currency convertor that gets the users input in the EditText
Share
Your program crashes with number format exception. You can do so:
You can also go with a regex: