我尝试与Facebook SDK 4.2共享图片和文字,但是当我调用共享功能(通过SDK或意图)时,我得到的是没有文字的图片。 这是代码
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + mFilepath));
shareIntent.putExtra(Intent.EXTRA_TEXT,"example");
shareIntent.setPackage("com.facebook.katana");
startActivity(shareIntent);
答案 0 :(得分:0)
试试这个
// By this method we can post on facebook.
private void publishFeedDialog() {
Session session = Session.getActiveSession();
//if(session==null)
{
// try to restore from cache
session = Session.openActiveSessionFromCache(dashBoard);
}
Bundle params = new Bundle();
params.putString("name", "MeetMeUp");
params.putString("caption", "Discover events nearby, easily create events and invite your friends!");
params.putString("description", "Finding, creating and sharing activities you’re passionate about are made easy with MeetMeUp. Whether you’re organizing a small gathering with friends, looking for a neighborhood football game or going to a local music concert, MeetMeUp makes it happen. ");
params.putString("link", "https://play.google.com/store/apps/details?id=com.meetmeup.activity");
params.putString("picture", "http://72.167.41.165/meetmeup/webservices/images/aaaaa-05.jpg");
WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(getActivity(),session, params)).setOnCompleteListener(
new OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
if (error == null) {
// When the story is posted, echo the success
// and the post Id.
final String postId = values.getString("post_id");
if (postId != null) {
Toast.makeText(getActivity(), "Posted story, id: " + postId, Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
Toast.makeText(getActivity().getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(getActivity().getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(getActivity().getApplicationContext(), "Error posting story", Toast.LENGTH_SHORT).show();
}
}
}).build();
feedDialog.show();
}
答案 1 :(得分:0)
请检查以下可能对您有用的代码。
Bundle parameters = new Bundle();
parameters.putString("message", category_item_name_desc.getText().toString());
parameters.putString("picture", categoryItemsModel.getImageUrl());
parameters.putString("caption", txtDescription_desc.getText().toString());
facebook.request("/me/feed", parameters, "POST");
答案 2 :(得分:0)
Facebook不允许预先填写邮件。 有关详细信息,请参阅this discussion。