0
私はsocializeを使ってFacebookに自分のコメントを共有する方法を次のコードを試しましたが、Facebookのホームページに直接入力します。 はここ私は社会化を使ってfbに私のコメントをどのように共有するのですか?
public class TraSocializeActivity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String entityKey = "http://www.getsocialize.com";
Entity entity = Entity.newInstance(entityKey, "Socialize");
View actionBarWrapped = Socialize.getSocializeUI().showActionBar(this, R.layout.main, entity);
setContentView(actionBarWrapped);
//this is the code for sharing my comments to facebook but its not working it allows the //user to enter the facebook directly
if(Socialize.getSocialize().isAuthenticated()) {
//Entity entity1 = Entity.newInstance("http://someurl.com", "My Entity");
String comment = "The comment to be added";
ShareOptions options = new ShareOptions();
options.setShareLocation(true);
options.setShareTo(SocialNetwork.FACEBOOK);
options.setListener(new SocialNetworkListener()
{
public void onError(Activity activity, SocialNetwork network, String message, Throwable e)
{
}
public void onBeforePost(Activity activity, SocialNetwork network)
{
}
{ // Handle before post
}
public void onAfterPost(Activity activity, SocialNetwork network)
{ // Handle after post
}
});
Socialize.getSocialize().addComment(this, entity, comment, options, new CommentAddListener()
{
public void onError(SocializeException error) {
// Handle error
}
public void onCreate(Comment comment)
{ // Handle success
}
});
}
}
}
"facebook home page"に入ると、facebookログインページが表示されますか?もしそうなら、これは正しい動作です。ユーザーは自分のFacebookアカウントへのアクセスをアプリに許可して壁に投稿できるように、Facebookで認証する必要があります。 –