Esempio n. 1
0
  private void login() {
    if (!validate()) {
      loginFailure();
      return;
    }

    loginButton.setEnabled(false);

    final ProgressDialog progressDialog = new ProgressDialog(LoginActivity.this);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("Authenticating...");
    progressDialog.show();

    HttpUtil httpUtil = HttpUtil.getInstance();
    httpUtil.login(
        createUrl(),
        createParams(),
        new HttpResponseCallback() {
          @Override
          public void onSuccess(String response) {
            System.out.println("success");
            loginSuccess(response);
          }

          @Override
          public void onFailure(String errorMsg) {
            System.out.println("failure");
            loginFailure();
          }
        });
  }
Esempio n. 2
0
  public void incrementViewCount() {
    String url = Config.SERVER_URL + "/like";
    HttpUtil httpUtil = HttpUtil.getInstance();
    httpUtil.like(
        url,
        createParams(),
        new HttpResponseCallback() {
          @Override
          public void onSuccess(String response) {}

          @Override
          public void onFailure(String errorMsg) {}
        });
  }