该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
public class InputPINActivity extends Activity{
TextView tv;
Toast toast;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pin_passwd);
sure_btn = (Button) findViewById(R.id.sure_btn);
sure_btn.setOnClickListener(pwd_sub);
}
/*realize Asyn loading*/
private class SendAsynTask extends AsyncTask {
private Activity activity;
private ProgressDialog progressDialog;
public SendAsynTask(Activity activity) {
this.activity = activity;
progressDialog = new ProgressDialog(activity);
}
protected void onPreExecute() {
this.progressDialog.setMessage("Loading...");
this.progressDialog.show();
}
@Override
protected void onPostExecute(final Boolean success) {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
}
@Override
protected Boolean doInBackground(String... params) {
showInfo(params[0]);
return true;
}
}
/* the sure Button click event */
private OnClickListener pwd_sub = new OnClickListener() {
@Override
public void onClick(View v) {
pinPwd = pinText.getText().toString().trim(); // get the text from EditView
SendAsynTask task=new SendAsynTask(InputActivity.this);
task.execute(new String[] { pwd });
}
private void showInfo(String pwd) {
if(!pwd.equals("")) {
tv.setText("Right!");
} else {
toast = Toast.makeText(getApplicationContext(), "Wrong!",
Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
}
}