Android GraphUser - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android GraphUser class.

This code example shows how to use the following methods:getBirthday, getFirstName, getId, getLastName, getLocation
        userPreference = new UserPreference(context);
    } 
 
    public void storeUser(GraphUser user) {
    	String location = null;
    	if (user.getLocation() != null) {
    		location = (String) user.getLocation().getProperty("name");
    	} 
        userPreference.storeUser(user.getFirstName(), user.getLastName(), user.getBirthday(), user.getId(), user.getUsername(), location);
    } 
 
    public String getFirstName() {
        return userPreference.getFirstName();
    } 
 
    public String getLastName() {
        return userPreference.getLastName();
    } 
 
    public String getBirthday() {
8
CodeRank
This code example shows how to use the following methods:getId
        assertEquals(2, responses.size());
 
        GraphUser user1 = responses.get(0).getGraphObjectAs(GraphUser.class);
        GraphUser user2 = responses.get(1).getGraphObjectAs(GraphUser.class);
 
        assertNotNull(user1);
        assertNotNull(user2);
 
        assertFalse(user1.getId().equals(user2.getId()));
        assertEquals(session.getTestUserId(), user1.getId());
        assertEquals("4", user2.getId());
    } 
 
    @LargeTest 
    public void testBatchWithNoSessionAndValidSession() { 
        TestSession session = openTestSessionWithSharedUser();
 
        Request request1 = new Request(null, "zuck");
        Request request2 = new Request(session, "me");
 
6
CodeRank
This code example shows how to use the following methods:getBirthday, getFirstName, getId, getLastName, getUsername
	} 
 
	private void initializeUserInfo(GraphUser user) {
		ContentValues cv = new ContentValues();
		database = getWritableDatabase();
		cv.put("userId", initializeUser(cv, user.getUsername(), user.getId()));
		cv.put("name", user.getFirstName());
		cv.put("surname", user.getLastName());
		cv.put("dob", user.getBirthday());
		cv.put("bio", getBio());
		cv.put("contacts", getContacts());
		cv.put("about", "");
		database.insert(tableUsersInfo, null, cv);
	} 
 
	public void insert(String table, String nullColumnHack, ContentValues values) {
		database = getWritableDatabase();
		database.insert(table, nullColumnHack, values);
		// database.close(); 
	} 
6
CodeRank
This code example shows how to use the following methods:getId
            request = requestBuilder.setCallerTag(this)
                    .setCallback(
                            new ImageRequest.Callback() {
                                @Override 
                                public void onCompleted(ImageResponse response) {
                                    processImageResponse(user.getId(), response);
                                } 
                            }) 
                    .build();
        } catch (URISyntaxException e) {
        } 
        return request;
    } 
 
    private void processImageResponse(String id, ImageResponse response) {
        if (response != null) {
            Bitmap bitmap = response.getBitmap();
            if (bitmap != null) {
                BitmapDrawable drawable = new BitmapDrawable(UserSettingsFragment.this.getResources(), bitmap);
                drawable.setBounds(0, 0,
6
CodeRank
This code example shows how to use the following methods:getId, getName
		mEmail = email;
	} 
 
	public void setWithGraphUser(GraphUser user) {
 
		mID = user.getId();
		mName = user.getName();
		mGraphUser = user;
	} 
 
	public String getID() {
 
		return mID;
	} 
 
	public String getName() {
 
		return mName;
	} 
 
4
CodeRank
This code example shows how to use the following methods:getProperty, getBirthday, getFirstName, getId, getLastName
				 
				JSONObject location = new JSONObject();
				 
				//must also check if I get all the data! 
				try { 
					me.put("username", user.getUsername());
					me.put("picture", "http://graph.facebook.com/" + user.getId() + "/picture");
					me.put("first_name", user.getFirstName());
					me.put("last_name", user.getLastName());
					me.put("name", user.getName());
					me.put("locale", user.getProperty("locale"));
					me.put("gender", user.getProperty("gender"));
					me.put("email", user.getProperty("email"));
					me.put("birthday", user.getBirthday());
					/*location.put("id", user.getLocation().getProperty("id")); 
					location.put("name", user.getLocation().getProperty("name"));*/ 
					me.put("location", location);
					me.put("timezone", user.getProperty("timezone"));
					me.put("updated_time", user.getProperty("updated_time"));
					me.put("id", user.getId());	

3
CodeRank
This code example shows how to use the following methods:getName
				@Override 
				public void onCompleted(GraphUser user, Response response) { 
					Log.d("TEST", "onCompleted user = " + user); 
					if (user != null) { 
 
						textInstructionsOrLink.setText("Hello " + user.getName() + "!"); 
					} 
				} 
			}); 
		} 
	} 
 
	private class SessionStatusCallback implements Session.StatusCallback { 
        @Override 
        public void call(Session session, SessionState state, Exception exception) { 
            updateView(); 
        } 
    } 
} 
3
CodeRank
This code example shows how to use the following methods:getFirstName, getId
 
                        // callback after Graph API response with user object 
                        @Override 
                        public void onCompleted(GraphUser user, Response response) {
                            if (user != null) {
                                String fbId = user.getId();
 
                                new FbTokenValidatorTask().execute( fbToken,  fbId);
 
                                Toast.makeText( ctx, "Username: " + user.getFirstName(), Toast.LENGTH_SHORT );
                            } 
                        } 
 
                    }); 
                } 
            } 
 
        }); 
    } 
 
4
CodeRank
This code example shows how to use the following methods:getId
	private void processImageResponse(String id, ImageResponse response) {
		if (response != null) {
			Bitmap bitmap = response.getBitmap();
			if (bitmap != null) {
				BitmapDrawable drawable = new BitmapDrawable(UserSettingsFragment.this.getResources(), bitmap);
				drawable.setBounds(
					0, 
					0, 
					getResources().getDimensionPixelSize( 
						R.dimen.com_facebook_usersettingsfragment_profile_picture_width), 
					getResources().getDimensionPixelSize( 
						R.dimen.com_facebook_usersettingsfragment_profile_picture_height)); 
				userProfilePic = drawable;
				userProfilePicID = id;
				connectedStateLabel.setCompoundDrawables(null, drawable, null, null);
				connectedStateLabel.setTag(response.getRequest().getImageUri());
			} 
		} 
	} 
} 
3
CodeRank
This code example shows how to use the following methods:getId
            @Override 
            public void onCompleted(Response response) {
                try { 
                    GraphUser user = response.getGraphObjectAs(GraphUser.class);
                    if (user != null) {
                        fbids.add(user.getId());
                    } 
                } catch (Exception ex) {
                } 
            } 
        }; 
 
        String validateSameFbidAsToken = pendingRequest.getPreviousAccessToken();
        Request requestCurrentTokenMe = createGetProfileIdRequest(validateSameFbidAsToken);
        requestCurrentTokenMe.setCallback(meCallback);
 
        Request requestNewTokenMe = createGetProfileIdRequest(newToken);
        requestNewTokenMe.setCallback(meCallback);
 
        Request requestCurrentTokenPermissions = createGetPermissionsRequest(validateSameFbidAsToken);
1
CodeRank

Related Android GraphUser Questions & Answers:

See Code Examples for Android GraphUser Methods: