我有这个代码,我有一个按钮,这个make出现一个编辑文本并强制软输入出现,当用户结束输入文本时我想做一些事情我怎么做?
public class MainActivity extends Activity implements OnClickListener {
private EditText textInput;
private Button btnAdd;
private TextView text;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textInput = (EditText)this.findViewById(R.id.editText1);
btnAdd = (Button)this.findViewById(R.id.button1);
text = (TextView)this.findViewById(R.id.textView1);
btnAdd.setOnClickListener(this);
}
public void onClick(View arg0) {
int id = arg0.getId();
switch(id){
case R.id.button1:
processOnClick();
break;
}
}
private void processOnClick() {
text.setVisibility(2);
textInput.setVisibility(0);
textInput.setInputType(0x00000001);
textInput.getWindowVisibility();
textInput.setCursorVisible(false);
//textInput.onKeyDown(0x00000009,KeyEvent.KEYCODE_2);
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(textInput.findFocus(), 0);
}
谢谢大家