我试图从edittext中获取一个值,然后将其转换为int,以便我可以处理减法/ additon /的值等等。这是我使用的代码,但我一直使用这段代码崩溃。从edittext获取int的值
number = (EditText) findViewById(R.id.editText);
angka = Integer.parseInt(number.getText().toString());
//my alternative code is like this : angka = Integer.parseInt(String.Valueof(number));
请我需要你的帮助,感谢你这么多
当它崩溃时,会出现什么错误? – tima
@tima没有错误,应用程序只是自动关闭 –
@AnonyLauly围绕代码块尝试和捕获。举行debuger,看到例外和发布。 – Aveek