This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 5th, 2012  |  syntax: None  |  size: 2.19 KB  |  views: 44  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  public void shareVideoOnFB(){
  2.         Facebook mFacebook = ((GlobalVars)getApplicationContext()).facebook;
  3.         AsyncFacebookRunner mAsyncRunner;
  4.         mAsyncRunner = new AsyncFacebookRunner(mFacebook);
  5.         Bundle params = new Bundle();
  6.         params.putString("message", "This string will appear as the status message");
  7.         params.putString("link", "This is the URL to go to");
  8.         params.putString("name", "This will appear beside the picture");
  9.         params.putString("description", "This will appear under the caption");
  10.  
  11.         mAsyncRunner.request("me/feed", params, new WallPostRequestListener());
  12.          
  13.  
  14.         Toast.makeText(PlaceInfo.this, "Posting to your Wall...", Toast.LENGTH_SHORT).show();      
  15.     }
  16.  public class WallPostRequestListener extends BaseRequestListener {
  17.  
  18.         public void onComplete(final String response, final Object state) {
  19.             Log.d("Facebook-Example", "Got response: " + response);
  20.             String message = "<empty>";
  21.             try {
  22.                 JSONObject json = Util.parseJson(response);
  23.                 message = json.getString("message");
  24.             } catch (JSONException e) {
  25.                 Log.w("Facebook-Example", "JSON Error in response");
  26.             } catch (FacebookError e) {
  27.                 Log.w("Facebook-Example", "Facebook Error: " + e.getMessage());
  28.             }
  29.             final String text = "Your Wall Post: " + message;
  30.         }
  31.     }
  32.     public abstract class BaseRequestListener implements RequestListener {
  33.  
  34.         public void onFacebookError(FacebookError e, final Object state) {
  35.             Log.e("Facebook", e.getMessage());
  36.             e.printStackTrace();
  37.         }
  38.  
  39.         public void onFileNotFoundException(FileNotFoundException e,
  40.                 final Object state) {
  41.             Log.e("Facebook", e.getMessage());
  42.             e.printStackTrace();
  43.         }
  44.  
  45.         public void onIOException(IOException e, final Object state) {
  46.             Log.e("Facebook", e.getMessage());
  47.             e.printStackTrace();
  48.         }
  49.  
  50.         public void onMalformedURLException(MalformedURLException e,
  51.                 final Object state) {
  52.             Log.e("Facebook", e.getMessage());
  53.             e.printStackTrace();
  54.         }
  55.     }
clone this paste RAW Paste Data