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


Java Response.getError方法代码示例

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


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

示例1: 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

示例2: 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

示例3: notifyIfError

import com.facebook.Response; //导入方法依赖的package包/类
/**
 * returns true if there was an error. The callback will be notified
 */
private boolean notifyIfError(Response response, Callback callback) {
    if (response.getError() != null) {
        FacebookRequestError error = response.getError();
        callback.onError(new SocialError(error.getException()));
        return true;
    }
    return false;
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:12,代码来源:FacebookProvider.java

示例4: publishStory

import com.facebook.Response; //导入方法依赖的package包/类
private void publishStory(Session session) 
{
	Bundle postParams = new Bundle();
	postParams.putString("name", "Você Fiscal");

	// Receber os dados da eleição!!!
	postParams.putString("message", "Eu fiscalizei a seção: "+ this.secao +"\nNa zona eleitoral: " + this.zonaEleitoral + "\nNo município de: " + this.municipio);			
	postParams.putString("description", "Obrigado por contribuir com a democracia!");
	postParams.putString("link", "http://www.vocefiscal.org/");
	postParams.putString("picture", "http://imagizer.imageshack.us/v2/150x100q90/913/bAwPgx.png");

	Request.Callback callback= new Request.Callback() 
	{
		public void onCompleted(Response response) 
		{
			JSONObject graphResponse = response.getGraphObject().getInnerJSONObject();
			String postId = "Compartilhado com sucesso!";
			try 
			{
				postId = graphResponse.getString("Compartilhado com sucesso!");
			} catch (JSONException e) 
			{
			}
			FacebookRequestError error = response.getError();
			if (error != null) 
			{
				Toast.makeText(FiscalizacaoConcluidaActivity.this.getApplicationContext(),error.getErrorMessage(),Toast.LENGTH_SHORT).show();
			} else 
			{
				Toast.makeText(FiscalizacaoConcluidaActivity.this.getApplicationContext(),	postId,	Toast.LENGTH_LONG).show();
			}
		}
	};

	Request request = new Request(session, "me/feed", postParams, HttpMethod.POST, callback);

	RequestAsyncTask task = new RequestAsyncTask(request);
	task.execute();
}
 
开发者ID:vocefiscal,项目名称:vocefiscal-android,代码行数:40,代码来源:FiscalizacaoConcluidaActivity.java

示例5: requestAccountName

import com.facebook.Response; //导入方法依赖的package包/类
/**
 * Asynchronously requests the user name associated with the linked account. Tries to finish the
 * {@link FacebookSettingsActivity} when completed.
 */
private void requestAccountName() {
    GraphUserCallback callback = new GraphUserCallback() {
        @Override
        public void onCompleted(GraphUser user, Response response) {
            FacebookSettingsActivity activity = (FacebookSettingsActivity) getActivity();
            if (activity == null || activity.isFinishing()) {
                return;
            }

            if (response != null && response.getError() == null && user != null) {
                String accountName = user.getFirstName() + " " + user.getLastName();
                if (accountName != null && accountName.length() > 0) {
                    activity.mAccountName = accountName;
                } else {
                    activity.mHasErrorOccurred = true;
                }
            } else {
                activity.mHasErrorOccurred = true;
            }

            activity.tryFinish();
        }
    };

    mFacebookEndpoint.requestAccountName(callback);
}
 
开发者ID:groundupworks,项目名称:wings,代码行数:31,代码来源:FacebookAlbumListFragment.java

示例6: onCompleted

import com.facebook.Response; //导入方法依赖的package包/类
public final void onCompleted(Response paramResponse)
{
  FacebookRequestError localFacebookRequestError = paramResponse.getError();
  if (localFacebookRequestError != null)
  {
    Toast.makeText(this.ˊ, localFacebookRequestError.getErrorMessage(), 0).show();
  }
  else if ((paramResponse.getGraphObject() != null) && (paramResponse.getGraphObject().getInnerJSONObject() != null))
  {
    ArrayList localArrayList = new ArrayList();
    try
    {
      JSONArray localJSONArray = paramResponse.getGraphObject().getInnerJSONObject().getJSONObject(this.ˋ.ʼ).getJSONArray("image");
      for (int i = 0; i < localJSONArray.length(); i++)
        localArrayList.add(localJSONArray.getJSONObject(i).getString("url"));
      OpenGraphAction localOpenGraphAction = ϳ.ˊ(this.ˋ, localArrayList);
      if (this.ˎ.equals("facebook"))
      {
        this.ˋ.ͺ.put("Destination", "facebook");
        Context localContext = this.ˊ.getApplicationContext();
        FacebookDialog.ShareDialogFeature[] arrayOfShareDialogFeature = new FacebookDialog.ShareDialogFeature[1];
        arrayOfShareDialogFeature[0] = FacebookDialog.ShareDialogFeature.SHARE_DIALOG;
        if (FacebookDialog.canPresentShareDialog(localContext, arrayOfShareDialogFeature))
        {
          this.ˊ.setPropertiesForFacebookSharing(this.ˋ.ͺ);
          FacebookDialog localFacebookDialog = new FacebookDialog.OpenGraphActionDialogBuilder(this.ˊ, localOpenGraphAction, this.ˋ.ʽ.ʼ).build();
          this.ˊ.getUiHelper().trackPendingDialogCall(localFacebookDialog.present());
        }
        else
        {
          ϳ.ˎ(this.ˊ, this.ˋ, (String)localArrayList.get(0));
        }
      }
      else if (this.ˎ.equals("facebook-messenger"))
      {
        ϳ.ˊ(this.ˊ, this.ˋ, localOpenGraphAction);
      }
    }
    catch (JSONException localJSONException)
    {
      localJSONException.printStackTrace();
    }
  }
  this.ˏ.dismiss();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:46,代码来源:œ≥$2.java

示例7: publishStory

import com.facebook.Response; //导入方法依赖的package包/类
private void publishStory()
{
	Session session = Session.getActiveSession();
	pendingPublishReauthorization = false;
	if (session != null)
	{

		// Check for publish permissions
		List<String> permissions = session.getPermissions();
		if (!isSubsetOf(PERMISSIONS, permissions))
		{
			pendingPublishReauthorization = true;
			Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(this, PERMISSIONS);
			session.requestNewPublishPermissions(newPermissionsRequest);
			return;
		}

		Bundle postParams = new Bundle();
		postParams.putString("name", "Facebook SDK for Android");
		postParams.putString("caption", "Build great social apps and get more installs.");
		postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
		postParams.putString("link", "https://developers.facebook.com/android");
		postParams.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");

		Request.Callback callback = new Request.Callback()
		{
			public void onCompleted(Response response)
			{
				JSONObject graphResponse = response.getGraphObject().getInnerJSONObject();
				String postId = null;
				try
				{
					postId = graphResponse.getString("id");
				}
				catch (JSONException e)
				{
					Log.i("KeyHash:", "JSON error " + e.getMessage());
				}
				FacebookRequestError error = response.getError();
				if (error != null)
				{
					Toast.makeText(getApplicationContext(), postId, Toast.LENGTH_SHORT).show();
				}
				else
				{
					Toast.makeText(getApplicationContext(), error.getErrorMessage(), Toast.LENGTH_LONG).show();
				}
			}
		};

		Request request = new Request(session, "me/feed", postParams, HttpMethod.POST, callback);
		RequestAsyncTask task = new RequestAsyncTask(request);
		task.execute();
	}

}
 
开发者ID:benoffi7,项目名称:cursoAndroidUTN,代码行数:57,代码来源:lay_facebook.java

示例8: getRequestExtraData

import com.facebook.Response; //导入方法依赖的package包/类
/**
 * Gets a facebook request information connecting with the
 * Facebook Graph API.<br><br>
 * 
 * See <a href="https://developers.facebook.com/docs/android/send-requests/">Facebook requests</a>
 * 
 * @param onAppRequestReceived
 * @param onAppRequestReceivedError
 * @param appContext
 * @param requestId
 */
public static void getRequestExtraData(final OnAppRequestReceivedActionCallback onAppRequestReceived,
		final OnAppRequestReceivedErrorActionCallback onAppRequestReceivedError,
		final Context appContext, final String requestId) throws FBSessionException {
	
	if(Session.getActiveSession()!=null && Session.getActiveSession().isOpened()) {
		// Create a new request for an HTTP GET with the
	    // request ID as the Graph path.
	    Request request = new Request(Session.getActiveSession(), 
	    		requestId, null, HttpMethod.GET, new Request.Callback() {

	                @Override
	                public void onCompleted(Response response) {
	                    // Process the returned response
	                    GraphObject graphObject = response.getGraphObject();
	                    FacebookRequestError error = response.getError();
	                    
	                    if (graphObject != null) {
	                    	// Check if there is extra data	                        
	                    	if (graphObject.getProperty("data") != null) {
	                            try {
	                            	AppRequestBean appRequestInfo = gson.fromJson((String)graphObject.getProperty("data"), AppRequestBean.class);
	                            	
	                                if(onAppRequestReceived!=null) {
	                                	//We set the received info and launch user event thread.
	                                	onAppRequestReceived.setAppRequestInfo(appRequestInfo);
	                                	onAppRequestReceived.start();
	                                }	                            	
	                                
	                            } catch (JsonSyntaxException e) {
	                            	if(onAppRequestReceivedError!=null) {
	                            		Log.e(ToolBox.TAG, "Error getting request info (" + e.getMessage() + ").", e);
	                            		onAppRequestReceivedError.setErrorMessage("Error getting request info (" + e.getMessage() + ")");
	                            		onAppRequestReceivedError.start();
	                            	}	                                
	                            }
	                        } else if (error != null) {
	                        	if(onAppRequestReceivedError!=null) {
                            		Log.i(ToolBox.TAG, "Error getting request info (" + error.getErrorCode() + "/'" + error.getErrorMessage() + "').");
                            		onAppRequestReceivedError.setErrorMessage("Error getting request info (" + error.getErrorCode() + "/'" + error.getErrorMessage() + "')");
                            		onAppRequestReceivedError.start();
                            	}	                            
	                        }
	                    }else{
	                    	if(onAppRequestReceived!=null) {
                            	//We set the received info and launch user event thread.
                            	onAppRequestReceived.setAppRequestInfo(null);
                            	onAppRequestReceived.start();
                            }	                    	
	                    }
	                }
	        });
	    // Execute the request asynchronously.
	    Request.executeBatchAsync(request);
	    
	}else{
		Log.i(ToolBox.TAG, "No current Facebook active session or not logged in.");
		throw new FBSessionException("No current Facebook active session or not logged in.");
	}
}
 
开发者ID:javocsoft,项目名称:javocsoft-toolbox,代码行数:71,代码来源:FbTools.java


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