上的应用程序崩溃,我有这样的代码:当我在“完成”按钮,点击数字键盘
final EditText edC = (EditText) findViewById(R.id.etC);
final String creditsS = edC.getText().toString().trim();
final TextView tvD = (TextView) findViewById(R.id.tvDisplay);
tvD.setText("Enter amount of credits");
edC.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
int credits = Integer.parseInt(creditsS);
if (actionId == EditorInfo.IME_ACTION_DONE) {
tvD.setText("Your amount of credits" + credits);
return true;
}
return false;
}
});
,当我点击“完成”按钮,应用程序崩溃。我不明白问题在哪里。请帮忙?谢谢!!!
logcat说什么? –
请发布logcat。 – nhaarman