当前位置: 首页>>代码示例>>Java>>正文


Java Response类代码示例

本文整理汇总了Java中com.facebook.Response的典型用法代码示例。如果您正苦于以下问题:Java Response类的具体用法?Java Response怎么用?Java Response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Response类属于com.facebook包,在下文中一共展示了Response类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUserFriendList

import com.facebook.Response; //导入依赖的package包/类
public static  Promise<List<GraphUser>, BError, Void>  getUserFriendList(){

        final Deferred<List<GraphUser>, BError, Void> deferred = new DeferredObject<>();

        
        if (!Session.getActiveSession().getState().isOpened())
        {
            return deferred.reject(new BError(BError.Code.SESSION_CLOSED));
        }
        Request req = Request.newMyFriendsRequest(Session.getActiveSession(), new Request.GraphUserListCallback() {
            @Override
            public void onCompleted(List<GraphUser> users, Response response) {
                deferred.resolve(users);
            }
        });

        req.executeAsync();
        
        return deferred.promise();
    }
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:21,代码来源:BFacebookManager.java

示例2: requestUserData

import com.facebook.Response; //导入依赖的package包/类
public void requestUserData( Session session ) {
    // Request user data and show the results
    Request.newMeRequest(session, new Request.GraphUserCallback() {

        @Override
        public void onCompleted(GraphUser user, Response response) {
            if (user != null) {
               User currentUser = new User();
                currentUser.setUserId(user.getId());
                currentUser.setUserName(user.getUsername());
                currentUser.setFirstName(user.getFirstName());
                currentUser.setLastName(user.getLastName());
                currentUser.setDisplayName(user.getName());
                currentUser.setMail((String) user.getProperty("email"));
                currentUser.setProviderDisplayName("Facebook");
                currentUser.setProvider(PROVIDER_NAME);
               FbLoginDelegate.this.mUserHelper.setCurrentUser(currentUser);
                if ( mUserSessionCallback != null) {
                    mUserSessionCallback.onLogin();
                }
            }
        }
    }).executeAsync();
}
 
开发者ID:alessandrogurgel,项目名称:pedefacil,代码行数:25,代码来源:FbLoginDelegate.java

示例3: fetchUserInfo

import com.facebook.Response; //导入依赖的package包/类
private void fetchUserInfo() {
    final Session currentSession = getSession();
    if (currentSession != null && currentSession.isOpened()) {
        if (currentSession != userInfoSession) {
            Request request = Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
                @Override
                public void onCompleted(GraphUser me, Response response) {
                    if (currentSession == getSession()) {
                        user = me;
                        updateUI();
                    }
                    if (response.getError() != null) {
                        loginButton.handleError(response.getError().getException());
                    }
                }
            });
            Bundle parameters = new Bundle();
            parameters.putString(FIELDS, REQUEST_FIELDS);
            request.setParameters(parameters);
            Request.executeBatchAsync(request);
            userInfoSession = currentSession;
        }
    } else {
        user = null;
    }
}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:27,代码来源:UserSettingsFragment.java

示例4: followNextLink

import com.facebook.Response; //导入依赖的package包/类
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:18,代码来源:GraphObjectPagingLoader.java

示例5: requestCompleted

import com.facebook.Response; //导入依赖的package包/类
private void requestCompleted(Response response) {
    Request request = response.getRequest();
    if (request != currentRequest) {
        return;
    }

    loading = false;
    currentRequest = null;

    FacebookRequestError requestError = response.getError();
    FacebookException exception = (requestError == null) ? null : requestError.getException();
    if (response.getGraphObject() == null && exception == null) {
        exception = new FacebookException("GraphObjectPagingLoader received neither a result nor an error.");
    }

    if (exception != null) {
        nextRequest = null;

        if (onErrorListener != null) {
            onErrorListener.onError(exception, this);
        }
    } else {
        addResults(response);
    }
}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:26,代码来源:GraphObjectPagingLoader.java

示例6: postStatus

import com.facebook.Response; //导入依赖的package包/类
public void postStatus(View view){
    EditText editText = (EditText) findViewById(R.id.editText);
    final String statusText = editText.getText().toString();
    Session session = Session.getActiveSession();
    if (session != null) {

        if (session.isOpened() && hasPublishPermission()) {
            Request request = Request
                    .newStatusUpdateRequest(Session.getActiveSession(), statusText, null, null, new Request.Callback() {
                        @Override
                        public void onCompleted(Response response) {
                            showPublishResult(statusText, response.getGraphObject(), response.getError());
                        }
                    });
            request.executeAsync();
            return;
        }
        else {
            Toast.makeText(this, getString(R.string.err_notConnected), Toast.LENGTH_SHORT).show();
        }
    }
    else {
        Toast.makeText(this, getString(R.string.err_notConnected), Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:jacquesgiraudel,项目名称:TP-Formation-Android,代码行数:26,代码来源:TestFacebookActivity.java

示例7: onSessionStateChange

import com.facebook.Response; //导入依赖的package包/类
/**
 * Changes the UI when an interaction with the Session object occurs with the user.
 * @param session       The current active Session.
 * @param sessionState  The current state of the active Session.
 * @param e             An Exception if there is one.
 */
private void onSessionStateChange(Session session, SessionState sessionState, Exception e) {
    if (sessionState == SessionState.OPENED) {
        Log.d(TAG, "Successful login!");
        new Request(session, "/me", null, HttpMethod.GET, new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                JSONObject obj = response.getGraphObject().getInnerJSONObject();
                Log.d(TAG, "Got back " + obj + " from Facebook API.");
                UserSession.getInstance().setFacebookData(obj);
                getUserData();
            }
        }).executeAsync();
    } else if (e != null) { // handle exception

    }
}
 
开发者ID:danfang,项目名称:house-devs,代码行数:23,代码来源:LoginFragment.java

示例8: call

import com.facebook.Response; //导入依赖的package包/类
@Override
public void call(Session session, SessionState state, Exception exception) {
	if (session.isOpened()) {
		setFacebookSession(session);
		// make request to the /me API
		Request.newMeRequest(session, new Request.GraphUserCallback() {

			// callback after Graph API response with user object
			@Override
			public void onCompleted(GraphUser user, Response response) {
				if (user != null) {
					Toast.makeText(LoginActivity.this,
							"Hello " + user.getName(), Toast.LENGTH_LONG)
							.show();
				}
			}
		}).executeAsync();
	}
}
 
开发者ID:jinman,项目名称:snake-game-aws,代码行数:20,代码来源:LoginActivity.java

示例9: populateContact

import com.facebook.Response; //导入依赖的package包/类
public void populateContact() {
    final Session session = Session.getActiveSession();
    new Request(session, "/me/friends", null, HttpMethod.GET,
            new Request.Callback() {
                public void onCompleted(Response response) {

                    // Process the returned response
                    GraphObject graphObject = response.getGraphObject();
                    if (graphObject != null) {
                        // Check if there is extra data
                        if (graphObject.getProperty("data") != null) {
                                JSONArray arrayObject = (JSONArray) graphObject
                                        .getProperty("data");

                                int count = arrayObject.length();
                                if(count == 0)
                                    hasAppFriends = false;
                                // Ensure the user has at least one friend
                                //session.close();
                        }
                    }
                }

            }).executeAsync();
}
 
开发者ID:3bytessolutions,项目名称:CallService-Facebook-sample,代码行数:26,代码来源:UserHome.java

示例10: onSessionStateChange

import com.facebook.Response; //导入依赖的package包/类
@Override
protected void onSessionStateChange(Session session, SessionState state, Exception exception){
    final TextView txtUserDetails = (TextView) mCurrentView.findViewById(R.id.mapViewLoggedInUser);
    if (session != null && session.isOpened()) {
        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user,
                                    Response response) {
                if (user != null) {
                    txtUserDetails.setText("Logged in as " + user.getName());
                    System.out.println("onSessionStateChange: LoadNotes: session is open. username:"+user.getName());
                }
            }
        });
        Request.executeBatchAsync(request);
    } else if (session.isClosed()) {
        txtUserDetails.setText("");
        System.out.println("onSessionStateChange: LoadNotes: session was closed.");
    }
}
 
开发者ID:ZanyGnu,项目名称:GeoNote,代码行数:21,代码来源:MapViewFragment.java

示例11: onSessionStateChangeP

import com.facebook.Response; //导入依赖的package包/类
private void onSessionStateChangeP(Session session, SessionState state, Exception exception)
{
    if (session != null && session.isOpened()) {
        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user,
                                    Response response) {
                if (user != null) {
                    LoggedInUser = user;
                }
            }
        });
        Request.executeBatchAsync(request);
    } else if (session.isClosed()) {
        LoggedInUser = null;
    }

    onSessionStateChange(session, state, exception);
}
 
开发者ID:ZanyGnu,项目名称:GeoNote,代码行数:20,代码来源:BaseFacebookHandlerFragment.java

示例12: onSessionStateChange

import com.facebook.Response; //导入依赖的package包/类
protected void onSessionStateChange(Session session, SessionState state, Exception exception){
    if (session != null && session.isOpened()) {
        logAndShowOnScreen("\nLogged in. Getting user details.");
        Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user,
                                    Response response) {
                if (user != null) {
                    System.out.println("onSessionStateChange: LoadNotes: session is open. username:"+user.getName());

                    loadNotes(getActivity(), user.getId());
                }
            }
        });
        Request.executeBatchAsync(request);
    } else {
        logAndShowOnScreen("\nUser not already logged in.");
        System.out.println("onSessionStateChange: LoadNotes: session was closed.");
        loadNotes(getActivity(), getLoggedInUsername());
    }
}
 
开发者ID:ZanyGnu,项目名称:GeoNote,代码行数:22,代码来源:SplashScreenFragment.java

示例13: populateLoggedInUser

import com.facebook.Response; //导入依赖的package包/类
private void populateLoggedInUser() {

            final TextView txtUserDetails = (TextView) this.getActivity().findViewById(R.id.userDetails);

            final Session session = Session.getActiveSession();
            if (session != null && session.isOpened()) {
                // If the session is open, make an API call to get user data
                // and define a new callback to handle the response
                Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
                    @Override
                    public void onCompleted(GraphUser user, Response response) {
                        // If the response is successful
                        if (session == Session.getActiveSession()) {
                            if (user != null) {
                                String user_ID = user.getId();//user id
                                String profileName = user.getName();//user's profile name
                                txtUserDetails.setText(user.getName());
                            }
                        }
                    }
                });
                Request.executeBatchAsync(request);
            } else if (session == null || session.isClosed()) {

            }
        }
 
开发者ID:ZanyGnu,项目名称:GeoNote,代码行数:27,代码来源:LoginActivityFB.java

示例14: onLoginFacebookCallback

import com.facebook.Response; //导入依赖的package包/类
private void onLoginFacebookCallback(final Session paramSession)
{
  if (paramSession.isOpened())
    Request.newMeRequest(paramSession, new Request.GraphUserCallback()
    {
      public void onCompleted(GraphUser paramAnonymousGraphUser, Response paramAnonymousResponse)
      {
        if (paramAnonymousGraphUser != null)
        {
          FacebookFriendsFragment.access$202(FacebookFriendsFragment.this, paramSession.getAccessToken());
          Object[] arrayOfObject = new Object[1];
          arrayOfObject[0] = FacebookFriendsFragment.this.fbAccessToken;
          ךּ.ˊ("REQUEST_FB_LINKING", arrayOfObject);
        }
      }
    }).executeAsync();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:18,代码来源:FacebookFriendsFragment.java

示例15: requestCompleted

import com.facebook.Response; //导入依赖的package包/类
private void requestCompleted(Response paramResponse)
{
  if (paramResponse.getRequest() != this.currentRequest)
    return;
  this.loading = false;
  this.currentRequest = null;
  FacebookRequestError localFacebookRequestError = paramResponse.getError();
  FacebookException localFacebookException;
  if (localFacebookRequestError == null)
    localFacebookException = null;
  else
    localFacebookException = localFacebookRequestError.getException();
  if ((paramResponse.getGraphObject() == null) && (localFacebookException == null))
    localFacebookException = new FacebookException("GraphObjectPagingLoader received neither a result nor an error.");
  if (localFacebookException != null)
  {
    this.nextRequest = null;
    if (this.onErrorListener != null)
      this.onErrorListener.onError(localFacebookException, this);
  }
  else
  {
    addResults(paramResponse);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:26,代码来源:GraphObjectPagingLoader.java


注:本文中的com.facebook.Response类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。