中的其余文本我想将文本添加到EditText而不会丢失以前的文本。如何将文本添加到Android
例:打字74
时,我想补充的"4"
文本框,但不删除之前输入的号码"7"
。
public void add4()
{
res = (EditText)findViewById(R.id.editText1);
if(res.getText().toString() == "0")
{
res.setText("4");
}
else
{
// add number 4 to the remaining string
}
}
使用'append'取代'settext.' – Raghunandan
'res.append( “4”);' – Houcine