I'm new to android. I'm developing a simple calculator application.
There is some problem in my code. There is no syntax error.
When I run it, it gives some error. Written all code in a try catch
but I'm still unable to catch it.
b1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//char x = lbldisp.getText().toString().charAt(1);
try
{
String x = lbldisp.getText().toString();
if(x.charAt(0)=='0' && x.charAt(1)!='.')
{
lbldisp.setText("1");
}
else
{
lbldisp.setText(x+"1");
}
}
catch(Exception e)
{
Toast.makeText(Calculator.this,e.getMessage().toString(), Toast.LENGTH_SHORT).show();
}
}
});