Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void shareVideoOnFB(){
- Facebook mFacebook = ((GlobalVars)getApplicationContext()).facebook;
- AsyncFacebookRunner mAsyncRunner;
- mAsyncRunner = new AsyncFacebookRunner(mFacebook);
- Bundle params = new Bundle();
- params.putString("message", "This string will appear as the status message");
- params.putString("link", "This is the URL to go to");
- params.putString("name", "This will appear beside the picture");
- params.putString("description", "This will appear under the caption");
- mAsyncRunner.request("me/feed", params, new WallPostRequestListener());
- Toast.makeText(PlaceInfo.this, "Posting to your Wall...", Toast.LENGTH_SHORT).show();
- }
- public class WallPostRequestListener extends BaseRequestListener {
- public void onComplete(final String response, final Object state) {
- Log.d("Facebook-Example", "Got response: " + response);
- String message = "<empty>";
- try {
- JSONObject json = Util.parseJson(response);
- message = json.getString("message");
- } catch (JSONException e) {
- Log.w("Facebook-Example", "JSON Error in response");
- } catch (FacebookError e) {
- Log.w("Facebook-Example", "Facebook Error: " + e.getMessage());
- }
- final String text = "Your Wall Post: " + message;
- }
- }
- public abstract class BaseRequestListener implements RequestListener {
- public void onFacebookError(FacebookError e, final Object state) {
- Log.e("Facebook", e.getMessage());
- e.printStackTrace();
- }
- public void onFileNotFoundException(FileNotFoundException e,
- final Object state) {
- Log.e("Facebook", e.getMessage());
- e.printStackTrace();
- }
- public void onIOException(IOException e, final Object state) {
- Log.e("Facebook", e.getMessage());
- e.printStackTrace();
- }
- public void onMalformedURLException(MalformedURLException e,
- final Object state) {
- Log.e("Facebook", e.getMessage());
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement