コード例 #1
0
        @SuppressWarnings("unchecked")
        @Override
        public void requestCompleted(String service, int type, String statusCode, String message)
            throws RemoteException {

          closeProgressDialog();
          if (statusCode != null
              && statusCode.equals("200")
              && message != null
              && !message.equals("[]")) {
            // Parser
            ArrayList<TimeLineInfo> timelineInfoList = new ArrayList<TimeLineInfo>();
            ParseHandler parseHandler = new ParseHandler();
            timelineInfoList =
                (ArrayList<TimeLineInfo>) parseHandler.parser(service, type, statusCode, message);

            if (timelineInfoList != null && timelineInfoList.size() > 0) {
              createPhotosView(timelineInfoList);
            }
          }
          if (!"200".equals(statusCode)) {
            Toast.makeText(
                    BrowseAlbumPhotosActivity.this,
                    ErrorMessage.getErrorMessage(BrowseAlbumPhotosActivity.this, statusCode),
                    Toast.LENGTH_SHORT)
                .show();
          }
        }
コード例 #2
0
        @Override
        public void requestCompleted(String service, int type, String statusCode, String message)
            throws RemoteException {

          if (statusCode != null && statusCode.equals("200")) {

            switch (type) {
              case CommHandler.TYPE_GET_NEW_TOKEN:
                {

                  // Prepare Parameter For Register Token
                  String[] messages = message.split(";");
                  accessToken = messages[0];
                  tokenSecret = messages[1];
                  registerToken(accessToken, tokenSecret);

                  break;
                }
              case CommHandler.TYPE_VERIFY_USER:
                {

                  // Parser
                  UserInfo userInfo = new UserInfo();
                  ParseHandler parseHandler = new ParseHandler();
                  userInfo = (UserInfo) parseHandler.parser(service, type, statusCode, message);

                  // Succeed
                  if (userInfo.getUid() != null) {

                    // Prepare Data
                    Bundle bundle = new Bundle();
                    bundle.putString("userName", userInfo.getScreenName());
                    bundle.putString("uid", userInfo.getUid());
                    bundle.putString("accessToken", accessToken);
                    bundle.putString("tokenSecret", tokenSecret);
                    bundle.putString("followers_count", userInfo.getFollowerCount());
                    Intent data = new Intent();
                    data.putExtras(bundle);
                    setResult(0, data);

                    // Finish
                    finish();

                  } else {
                    // Error
                    showErrorMessage(statusCode);
                  }
                }
              default:
                {
                }
            }
          }
        }