Example #1
0
 @Override
 public void onClick(DialogInterface dialog, int which) {
   switch (which) {
     case R.id.bt_1:
       //            if (spUsername.getSelectedItem() == null) {
       //                break;
       //            }
       String pwd = etPassword.getText().toString();
       String user = spUsername.getText().toString();
       LoginTask task = makeLoginTask(user, pwd);
       task.execute();
       break;
     case R.id.bt_2:
       cancel();
       break;
   }
 }
Example #2
0
  private LoginTask makeLoginTask(String user, String pwd) {
    LoginTask task = new LoginTask(getContext(), user, pwd);
    task.setCallback(
        new Callback() {
          @Override
          public void onSuccess(HandlerMessageTask task, Object t) {
            if (mOnLoginSuccessListener != null) {
              mOnLoginSuccessListener.onLoginSuccess();
            }
            cancel();
          }

          @Override
          public void onFail(HandlerMessageTask task, Object t) {
            cancel();
          }
        });
    return task;
  }