Android Response - 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 Response class.

This code example shows how to use the following methods:getGraphObject, getRequest
    public FacebookResponse(Context context) {
        responsePreference = new ResponsePreference(context);
    } 
 
    public void storeResponse(Response response) {
        responsePreference.storeResponse((String) response.getGraphObject().getProperty("email"), (String) response.getGraphObject().getProperty("gender"), response.getRequest().getSession().getApplicationId(), response.getRequest().getSession().getAccessToken());
    } 
 
    public String getEmail() {
        return responsePreference.getEmail();
    } 
 
    public String getGender() {
        return responsePreference.getGender();
    } 
 
    public String getAppId() {
        return responsePreference.getAppId();
    } 
 
6
CodeRank
This code example shows how to use the following methods:getGraphObject
		Request.executeBatchAsync(request);
	} 
	 
	public static String parsMeProfilePictureResponce(Response response){
		String imageUrl = null;
		GraphObject graphObject = response.getGraphObject();
		if (graphObject == null) {
			exception = new Exception("Response doesn't contain url.");
		} else { 
			JSONObject jsonObject = graphObject.getInnerJSONObject();
			if (jsonObject.has(Response.NON_JSON_RESPONSE_PROPERTY)){
				try { 
					//byte[] urlInByteArray = jsonObject.getString(Response.NON_JSON_RESPONSE_PROPERTY).getBytes("UTF-8"); 
					//imageUrl = new String(urlInByteArray); 
					imageUrl = jsonObject.getString(Response.NON_JSON_RESPONSE_PROPERTY);
					Log.d(TAG, "url = " + imageUrl);
				} catch (JSONException e) {
					exception = e;
				} /*catch (UnsupportedEncodingException e) { 
					exception = e; 
3
CodeRank
This code example shows how to use the following methods:getError, toString
				new Request.Callback() {
					@Override 
					public void onCompleted(Response response) {
						Log.d("Facebook", "here 1");
						// TODO Auto-generated method stub 
						FacebookRequestError error = response.getError();
						Log.d("Facebook", "Result: " + response.toString());
					} 
				}); 
		Request.executeBatchAsync(request);
 
	} 
 
	/* 
	 * Might be used later. private void updateUI() { Session session = 
	 * Session.getActiveSession(); boolean enableButtons = (session != null && 
	 * session.isOpened()); //submitbutton.setEnabled(enableButtons); } 
	 */ 
} 
6
CodeRank
This code example shows how to use the following methods:getGraphObject
				}); 
		request.executeAsync();
	} 
 
	public ArrayList<String> buildValuesFromResponse(Response response) {
		JSONObject responseJson = response.getGraphObject()
				.getInnerJSONObject();
		ArrayList<String> values = new ArrayList<String>();
		JSONArray jArray;
		try { 
			jArray = responseJson.getJSONArray("data");
 
			for (int i = 0; i < jArray.length(); i++) {
 
				JSONObject j = jArray.getJSONObject(i);
				 
				if (j.has("message")) {
					String text = j.getString("message");
					Pattern pattern = Pattern.compile("\\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]");
					Matcher matcher = pattern.matcher(text);
3
CodeRank
This code example shows how to use the following methods:getGraphObject
	} 
 
	@Override 
	public void onCompleted(Response response) {
		progressDialog.dismiss();
		GraphObject obj = response.getGraphObject();
		Log.d("", "response: " + obj.getInnerJSONObject());
		 
		String txt = "Publicado com sucesso!";
		Toast.makeText(this, txt, Toast.LENGTH_SHORT).show();
		goBack(null); 
	} 
 
	public static void setSolicitationName(String name, String pronoum) {
		solicitationName = name;
		solicitationPronoum = pronoum;
		 
	} 
	 
} 
3
CodeRank
This code example shows how to use the following methods:getError, getGraphObjectAs
			// If the activity is null, then we cannot 
			// show any dialogs, so we return. 
			return; 
		} 
 
		PostResponse postResponse = response.getGraphObjectAs(PostResponse.class);
 
		if (postResponse != null && postResponse.getId() != null) {
			 
		} else { 
			handleError(response.getError());
		} 
	} 
	 
	private interface PostResponse extends GraphObject {
		String getId();
	} 
	 
	private void handleError(FacebookRequestError error) {
		DialogInterface.OnClickListener listener = null;
4
CodeRank
This code example shows how to use the following methods:toString
                public void run() { 
                	Request request = Request
                            .newStatusUpdateRequest(Session.getActiveSession(), _msg, new Request.Callback() {
                                @Override 
                                public void onCompleted(Response response) {
                                	Log.v("postStatus response ", response.toString());
                                } 
                            }); 
                    request.executeAsync();
 
                } 
            }); 
        } 
    } 
     
    public void postStatus(String msg, String imageName)
    { 
    	if(!m_isInitial)
    		return; 
    	final String _msg = new String(msg);
4
CodeRank
This code example shows how to use the following methods:getGraphObject
		 
	}  
	 
	private void extractFeeds(Response s)
	{ 
		 GraphObject graphObject =s.getGraphObject();
		 if (graphObject != null)
         { 
             if (graphObject.getProperty("data") != null)
             { 
                  
                     String json = graphObject.getProperty("data").toString();
                     FBmsgs.setnewsFeedsList(json);
                     loadMsgs(); 
             } 
         } 
	} 
	 
 
} 
4
CodeRank
This code example shows how to use the following methods:toString
            Request friendRequest = Request.newMyFriendsRequest(activeSession, 
                new GraphUserListCallback(){
                    @Override 
                    public void onCompleted(List<GraphUser> users,
                            Response response) {
                        Log.i("INFO", response.toString());
                        onlyList = users;
                        reLoadFriends(); 
                         
 
                    } 
            }); 
            Bundle params = new Bundle();
            params.putString("fields", "id, name, picture");
            params.putString("limit", "50");
            friendRequest.setParameters(params);
            friendRequest.executeAsync();
        } 
    } 
    private void reLoadFriends(){ 
3
CodeRank

Related Android Response Questions & Answers:

See Code Examples for Android Response Methods: