我想在按下按钮后将我的 EditText 重置为空的“空格”或“提示”,该按钮将完成使用 EditText 字段输入的 Activity 。
我与 android 的冒险由此开始。
干杯。谢谢!!
//************-------------------SEND SMS----------------*********//
btnSendSMS = (Button)findViewById(R.id.sms);
btnSendSMS.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
sendSMS(dispEd.getText().toString(),msgEd.getText().toString());
}
private void sendSMS(String phoneNumber, String msg) {
// TODO Auto-generated method stub
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, msg, null, null);
}
});
}
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/edit"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/msg"/>
最佳答案
你应该试试
editText.setText("");
更新:尝试将文本设置为 null
editText.setText(null);
关于android - 如何在操作完成后重置 EditText?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7241808/