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


Java Callback类代码示例

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


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

示例1: followNextLink

import com.facebook.Request.Callback; //导入依赖的package包/类
public void followNextLink()
{
  if (this.nextRequest != null)
  {
    this.appendResults = true;
    this.currentRequest = this.nextRequest;
    this.currentRequest.setCallback(new Request.Callback()
    {
      public void onCompleted(Response paramAnonymousResponse)
      {
        GraphObjectPagingLoader.this.requestCompleted(paramAnonymousResponse);
      }
    });
    this.loading = true;
    Request.executeBatchAsync(putRequestIntoBatch(this.currentRequest, this.skipRoundtripIfCached));
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:18,代码来源:GraphObjectPagingLoader.java

示例2: requestAccounts

import com.facebook.Request.Callback; //导入依赖的package包/类
/**
 * Asynchronously requests the Page accounts associated with the linked account. Requires an opened active {@link Session}.
 *
 * @param callback a {@link Callback} when the request completes.
 * @return true if the request is made; false if no opened {@link Session} is active.
 */
boolean requestAccounts(Callback callback) {
    boolean isSuccessful = false;

    Session session = Session.getActiveSession();
    if (session != null && session.isOpened()) {
        // Construct fields to request.
        Bundle params = new Bundle();
        params.putString(ACCOUNTS_LISTING_FEILDS_KEY, ACCOUNTS_LISTING_FIELDS_VALUE);

        // Construct and execute albums listing request.
        Request request = new Request(session, ACCOUNTS_LISTING_GRAPH_PATH, params, HttpMethod.GET, callback);
        request.executeAsync();

        isSuccessful = true;
    }
    return isSuccessful;
}
 
开发者ID:groundupworks,项目名称:wings,代码行数:24,代码来源:FacebookEndpoint.java

示例3: requestAlbums

import com.facebook.Request.Callback; //导入依赖的package包/类
/**
 * Asynchronously requests the albums associated with the linked account. Requires an opened active {@link Session}.
 *
 * @param id       may be {@link #ME} or a Page id.
 * @param callback a {@link Callback} when the request completes.
 * @return true if the request is made; false if no opened {@link Session} is active.
 */
boolean requestAlbums(String id, Callback callback) {
    boolean isSuccessful = false;

    Session session = Session.getActiveSession();
    if (session != null && session.isOpened()) {
        // Construct fields to request.
        Bundle params = new Bundle();
        params.putString(ALBUMS_LISTING_LIMIT_KEY, ALBUMS_LISTING_LIMIT_VALUE);
        params.putString(ALBUMS_LISTING_FEILDS_KEY, ALBUMS_LISTING_FIELDS_VALUE);

        // Construct and execute albums listing request.
        Request request = new Request(session, id + TO_ALBUMS_LISTING_GRAPH_PATH, params, HttpMethod.GET, callback);
        request.executeAsync();

        isSuccessful = true;
    }
    return isSuccessful;
}
 
开发者ID:groundupworks,项目名称:wings,代码行数:26,代码来源:FacebookEndpoint.java

示例4: createAlbum

import com.facebook.Request.Callback; //导入依赖的package包/类
private void createAlbum() {
	// TODO Auto-generated method stub
	Bundle params = new Bundle();
	params.putString("name", ViewStory.this.story.getName());
	params.putString("message", ViewStory.this.story.getComment());
	Request request = new Request(MainActivity.session, "me/albums", params, 
                     HttpMethod.POST);
	request.setCallback(new Request.Callback() {
		@Override
		public void onCompleted(Response response) {
			// TODO Auto-generated method stub
			try {
				jo = response.getGraphObject().getInnerJSONObject().getJSONArray("data").getJSONObject(0);
				Toast.makeText(ViewStory.this, "ALBUM CREATION COMPLETED\n", Toast.LENGTH_LONG).show();
				uploadImagesToAlbum(jo);
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				Toast.makeText(ViewStory.this, "ALBUM CREATION FAILED\n", Toast.LENGTH_LONG).show();
			} 
			
		}
	});
	request.executeAsync();
}
 
开发者ID:Malatawy15,项目名称:BagOfPix,代码行数:26,代码来源:ViewStory.java

示例5: uploadImagesToAlbum

import com.facebook.Request.Callback; //导入依赖的package包/类
private void uploadImagesToAlbum(JSONObject jo) throws JSONException {
	// TODO Auto-generated method stub
	ArrayList<Photo> photos = db.get_photos(ViewStory.this.story.getId());
	for (int i = 0; i < photos.size(); i++) {
		String imgUrl = photos.get(i).getUrl();
		Bitmap bmp = BitmapFactory.decodeFile(imgUrl);
		String imgComment = photos.get(i).getComment();
		ByteArrayOutputStream stream = new ByteArrayOutputStream();
		bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
		byte[] byteArray = stream.toByteArray();
		Bundle params = new Bundle();
		params.putByteArray("source", byteArray);
		params.putString("message", imgComment);
		Request rr = new Request(MainActivity.session, jo.getString("id")+"/photos", params, HttpMethod.POST);
		rr.setCallback(new Callback() {
			
			@Override
			public void onCompleted(Response response) {
				// TODO Auto-generated method stub
				Toast.makeText(ViewStory.this, "PHOTO ADDED SUCESSFULLY", Toast.LENGTH_LONG).show();
			}
		});
		rr.executeAsync();
	}

}
 
开发者ID:Malatawy15,项目名称:BagOfPix,代码行数:27,代码来源:ViewStory.java

示例6: startLoading

import com.facebook.Request.Callback; //导入依赖的package包/类
private void startLoading(Request paramRequest, boolean paramBoolean, long paramLong)
{
  this.skipRoundtripIfCached = paramBoolean;
  this.appendResults = false;
  this.nextRequest = null;
  this.currentRequest = paramRequest;
  this.currentRequest.setCallback(new Request.Callback()
  {
    public void onCompleted(Response paramAnonymousResponse)
    {
      GraphObjectPagingLoader.this.requestCompleted(paramAnonymousResponse);
    }
  });
  this.loading = true;
  Runnable local3 = new Runnable()
  {
    public void run()
    {
      Request.executeBatchAsync(this.val$batch);
    }
  };
  if (paramLong == 0L)
  {
    local3.run();
    return;
  }
  new Handler().postDelayed(local3, paramLong);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:29,代码来源:GraphObjectPagingLoader.java

示例7: postStatus

import com.facebook.Request.Callback; //导入依赖的package包/类
@Override
public void postStatus(Activity activity, String message, AggregatorPlace place) {
	Session session = Session.getActiveSession();
	if(session != null && session.isOpened()){
		
        // Check for publish permissions
        List<String> permissions = session.getPermissions();
        if(!permissions.contains("publish_stream")){
        	
            Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(activity, Arrays.asList("publish_stream"));
            session.requestNewPublishPermissions(newPermissionsRequest);
            return;
        }
		
        GraphPlace gPlace = null;
        
        RawPlace providerPlace = PlaceHelper.getRawPlaceFromAggregator(activity, place, Provider.FACEBOOK);
        
        if(providerPlace != null){
        	gPlace = GraphObject.Factory.create(GraphPlace.class);
        	gPlace.setId(providerPlace.getRawReference());
        }  	
        
        Request request = Request.newStatusUpdateRequest(session, message, gPlace, null, new Request.Callback(){
        	@Override
        	public void onCompleted(Response response) {
        		Log.i(TAG , "POSTED: " + response.toString());
        		
        	}
        	
        });
        
        request.executeAsync();
	}
}
 
开发者ID:vegaen,项目名称:UbiNomadLib,代码行数:36,代码来源:FacebookProviders.java

示例8: getFriends

import com.facebook.Request.Callback; //导入依赖的package包/类
protected void getFriends(final Context context, final Session session, 
		final GraphUser user, final ModelCallback<JSONArray> callback) {
	Request.newGraphPathRequest(session, "/me/friends", new Callback() {
		@Override
		public void onCompleted(Response response) {
			if (response.getError() != null) {
				callback.error(response.getError().getException());
				return;
			}
			matchContacts(context, user, response, callback);
		}
	}).executeAsync();
}
 
开发者ID:buddycloud,项目名称:buddycloud-android,代码行数:14,代码来源:FacebookContactMatcher.java

示例9: getPlaceFromReference

import com.facebook.Request.Callback; //导入依赖的package包/类
@Override
public RawPlace getPlaceFromReference(String id) {
	final Session session = Session.getActiveSession();
	if (session != null & session.isOpened()) {
		
		// Make an API call to get nearby places and define a new callback to handle the response
		Request request = Request.newGraphPathRequest(session, id, new Callback() {
			
			@Override
			public void onCompleted(Response response) {
				
			}
		});
		
		GraphPlace graphPlace = request.executeAndWait().getGraphObject().cast(GraphPlace.class);
		
		return createPlace(graphPlace);
		
	}
	
	return null;
	
}
 
开发者ID:vegaen,项目名称:UbiNomadLib,代码行数:24,代码来源:FacebookProviders.java


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