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


Java Response.getGraphObject方法代码示例

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


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

import com.facebook.Response; //导入方法依赖的package包/类
public static final void parseUserFromFQLResponse( Response response )
{
    try
    {
        GraphObject go  = response.getGraphObject();
        JSONObject  jso = go.getInnerJSONObject();
        JSONArray   arr = jso.getJSONArray( "data" );

        for ( int i = 0; i < ( arr.length() ); i++ )
        {
            JSONObject json_obj = arr.getJSONObject( i );

            String id     = json_obj.getString( "id"           );
            String name   = json_obj.getString( "name"          );
            String urlImg = json_obj.getString( "picture"    );
            
            Log.d(TAG, name);

        }
    }
    catch ( Throwable t )
    {
        t.printStackTrace();
    }
}
 
开发者ID:josenaves,项目名称:facebook-friends,代码行数:26,代码来源:FriendsActivity.java

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

示例5: insertFriends

import com.facebook.Response; //导入方法依赖的package包/类
public void insertFriends(final Activity activity, final FacebookSettingActivity.ToastHelper th) {
    final Set<String> facebookIds = getContactsFacebookIds(activity);
    
    String fql = "SELECT uid, name, username, pic, pic_big FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())";

    Bundle params = new Bundle();
    params.putString("q", fql);
    final FacebookIdSaver fbs = new FacebookIdSaver();
    Session session = Session.getActiveSession();
    Request request = new Request(session, "/fql", params, HttpMethod.GET,
            new Request.Callback() {
              public void onCompleted(Response response) {
                try {
                  GraphObject go = response.getGraphObject();
                  if (go == null) {
                    th.showToast(activity.getString(R.string.unable_to_update_fb_contact));
                    return;
                  }
                  JSONObject jso = go.getInnerJSONObject();
                  JSONArray arr = jso.getJSONArray("data");
                  int count = arr.length();

                  // display some statistics
                  Date start = new Date();
                  int toastInterval = 20;
                  long nextToast = start.getTime() + toastInterval * 1000;
                  Resources res = activity.getResources();
                  for (int i = 0; i < count; i++) {
                    // count statistics
                    String timeleftStr = "";
                    if (new Date().getTime() > nextToast) {
                      int diff = (int) (new Date().getTime() - start.getTime());
                      int timeLeftInSec = (int) ((diff / (i + 1)) * (count - i)) / 1000;
                      Log.d("rgai", "remaining synctime -> " + timeLeftInSec);
                      int timeLeftInMin = timeLeftInSec / 60;
                      if (timeLeftInMin > 0) {
                        timeLeftInSec -= timeLeftInMin * 60;
                      }
                      String min = timeLeftInMin > 0 ? res.getQuantityString(R.plurals.minutes, timeLeftInMin, timeLeftInMin) : "";
                      String sec = timeLeftInSec > 0 ? res.getQuantityString(R.plurals.seconds, timeLeftInSec, timeLeftInSec) : "";
                      timeleftStr = min + " " + sec;
                      String toastStr = String.format(activity.getString(R.string.still_updating_xtime_left), timeleftStr);
                      th.showToast(toastStr);
//              Toast.makeText(activity, timeleftStr + , Toast.LENGTH_LONG).show();
                      nextToast += toastInterval * 1000;
                    }
                    JSONObject json_obj = arr.getJSONObject(i);

                    if (!(facebookIds.contains(json_obj.getString("uid")))) {

                      //ezek adják vissza a szükséges adatokat
                      String uid = json_obj.getString("uid");
                      String name = json_obj.getString("name");
                      String username = json_obj.getString("username");

                      FacebookIntegrateItem fbii = new FacebookIntegrateItem(name, username, uid, json_obj.getString("pic"), json_obj.getString("pic_big"));
                      fbs.integrate(activity, fbii);

                    } else {
//                      Log.d("rgai", "ez a contact id mar bennevan: " + json_obj.getString("uid") + ": " + json_obj.getString("name"));
                    }

//            Log.d("rgai", "Integrating user ("+ (i+1) +"/"+ arr.length() +") -> " + name);
                  }
                } catch (JSONException e) {
                  Log.d("rgai", "json exception", e);
                }
              }
            });

    Request.executeAndWait(request);
  }
 
开发者ID:k-kojak,项目名称:yako,代码行数:73,代码来源:FacebookFriendProvider.java

示例6: onClickPickQuery

import com.facebook.Response; //导入方法依赖的package包/类
public void onClickPickQuery() {

    String fqlQuery = "{"
        + "'notifications':'SELECT unread, unseen,recent_authors, thread_id FROM thread where folder_id=0 AND unseen > 0 ORDER BY thread_id DESC ',"
        + "'messages':'SELECT author_id, created_time, body FROM message WHERE thread_id IN "
        + "(SELECT thread_id FROM #notifications)',"
        + "'users':'SELECT uid, name, pic_square FROM user WHERE uid IN "
        + "(SELECT author_id FROM #messages)',"
        + "}";

    Bundle params = new Bundle();
    params.putString("q", fqlQuery);

    Session session = Session.getActiveSession();
    Request request = new Request(session, "/fql", params, HttpMethod.GET,
        new Request.Callback() {
          @Override
          public void onCompleted(Response response) {

            try {

              GraphObject go = response.getGraphObject();
              JSONObject jso = go.getInnerJSONObject();
              JSONArray arr = jso.getJSONArray("data").getJSONObject(1)
                  .getJSONArray("fql_result_set");
              JSONArray arr2 = jso.getJSONArray("data").getJSONObject(2)
                  .getJSONArray("fql_result_set");

              if (arr.length() != 0) {
                String name = "";
                for (int i = 0; i < (arr.length()); i++) {

                  JSONObject json_obj = arr.getJSONObject(i);
                  JSONObject json_obj2;

                  for (int j = 0; j < (arr2.length()); j++) {

                    json_obj2 = arr2.getJSONObject(j);

                    if (json_obj.getString("author_id").contains(json_obj2.getString("uid"))) {
                      name += json_obj2.getString("name");
                      name += " : ";

                    }

                  }

                  name += json_obj.getString("body");
                  name += "\n";
                  Log.i("FONTOS", name.toString());

                }

              } else {

                Log.i("FONTOS", "Nincs adat!");
              }

        } catch (JSONException e) {
          Log.d("rgai", "", e);
        }

          }
        });
    Request.executeAndWait(request);

  }
 
开发者ID:k-kojak,项目名称:yako,代码行数:68,代码来源:FacebookMessageProvider.java

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