daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private class FacebookPoster extends AsyncTask<String, Object, Object>
  2.     {
  3.  
  4.         @Override
  5.         protected Object doInBackground(String... message)
  6.         {
  7.             Bundle parameters = new Bundle();
  8.             parameters.putString("message", message[0]);
  9.             parameters.putString("description", "topic share");
  10.             parameters.putString("link", ctx.getResources().getString(R.string.rateLink));
  11.             parameters.putString("picture", ctx.getResources().getString(R.string.linkIconPicture));
  12.             Log.d("ERRRR", "set params");
  13.             try
  14.             {
  15.                 facebook.request("me");
  16.                 String response = facebook.request("me/feed", parameters, "POST");
  17.                 Log.d("Tests", "got response: " + response);
  18.                 if (response == null || response.equals("") || response.equals("false"))
  19.                 {
  20.                     return "Blank response.";
  21.  
  22.                 }
  23.                 else
  24.                 {
  25.                     return "Message posted to your facebook wall!";
  26.  
  27.                 }
  28.             }
  29.             catch (Exception e)
  30.             {
  31.                 return "Failed to post to wall!";
  32.             }
  33.         }
  34.  
  35.         @Override
  36.         protected void onProgressUpdate(Object... values)
  37.         {
  38.             // TODO Auto-generated method stub
  39.             super.onProgressUpdate(values);
  40.             showToast(values);
  41.  
  42.         }
  43.     }
  44.    
  45. private void showToast(Object message)
  46.     {
  47.         Toast.makeText(ctx, message.toString(), Toast.LENGTH_SHORT).show();
  48.     }
  49.    
  50. publishProgress(<somenumber>);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top