I have been trying to make wall post from multiple pages but when i try to make post from other pages except original facebook page, it is giving me an exception of java.lang.NullPointerException
The method i am calling and created in a Facebook page
public void postOnWall(String msg) {
Log.d("Tests", "Testing graph API wall post");
try {
String response = mFacebook.request("me");
Bundle parameters = new Bundle();
parameters.putString("message", msg);
parameters.putString("description", "test test test");
response = mFacebook.request("me/feed", parameters,
"POST");
Log.d("Test开发者_StackOverflow社区s", "got response: " + response);
if (response == null || response.equals("") ||
response.equals("false")) {
Log.v("Error", "Blank response");
}
} catch(Exception e) {
e.printStackTrace();
}
}
and code to call this method.
try {
mFacebookObj.postOnWall("Add poi");
} catch(Exception e){
e.printStackTrace();
}
both are activity classes.
Now can anyone tell me how shall i call this method from outside this page and make post over facebook wall
The answer is, to make wall post from from multiple pages, just restore values of access_token and token_expire value in faceook object.. and then use mFacebook.request(...); That works as Facebook object needs to have access token and access token expire value provided by facebook itself in response given at the time of login with facebook
精彩评论