1. Are you ready for the Galaxy S20? Here is everything we know so far!

Passing Variable to RequestListener

Discussion in 'Android Development' started by redbrad0, Sep 14, 2011.

  1. redbrad0

    redbrad0 Lurker
    Thread Starter

    I have a RequestListener which is all working, but I can't seem to figure out how to pass a variable to the request listener. Can someone point me in the right way? I am trying to pass the friendID to the fbFriendID inside the onComplete function.

    Code (Text):
    1.  
    2. public void PostOnWall(String friendID, String Message)    {
    3.     Bundle params = new Bundle();
    4.     params.putString("message", Message);
    5.     asybcTastRun.request(friendID + "/feed", params, "POST", new PostOnWallRequest(), null);
    6. }
    7. class PostMessageOnWallRequest implements AsyncFacebookRunner.RequestListener    {
    8.     public void onComplete(String response, Object state) {
    9.         String fbResponse = response;
    10.         // TODO: I need the "friendID" here
    11.         String fbFriendID = "??";
    12.         Log.i("fbPost", "Posted on friend:" + fbFriendID + " with response:" + fbResponse);
    13.     }
    14.     public void onIOException(IOException e, Object state) {
    15.         // TODO Auto-generated method stub
    16.     }
    17.     public void onFileNotFoundException(FileNotFoundException e, Object state) {
    18.         // TODO Auto-generated method stub
    19.     }
    20.     public void onMalformedURLException(MalformedURLException e, Object state) {
    21.         // TODO Auto-generated method stub
    22.     }
    23.     public void onFacebookError(FacebookError e, Object state) {
    24.         // TODO Auto-generated method stub
    25.     }
    26. }
    27.  
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...