0
someone could help me please.
I am with a problem, I made a setonfocus in my app, for it calculate and show the result as soon as the user click outside the edittext, however if the user does not type anything, the app closes and error in Integer.parserint someone here has already gone through it and could help me please. I wanted that if the user did not enter anything, the app continued.
precoEdittext.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus && precoEdittext.getText().toString() != null){
String tempEdittextqtd = qtdEdittext.getText().toString();
int qtdEdittextI = 0;
qtdEdittextI = Integer.parseInt(tempEdittextqtd);
String tempEdittextprec = precoEdittext.getText( ).toString( );
int precoEdittextI = 0 ;
precoEdittextI = Integer.parseInt( tempEdittextprec );
resulEdittext = qtdEdittextI * precoEdittextI;
totalEdittext.setText(String.valueOf("R$"+resulEdittext));
Toast.makeText(getApplicationContext(),"TOTAL EDITTEXT "+totalEdittext.getText().toString(), Toast.LENGTH_SHORT).show();
}
}
});