我们如何实现与左侧的印章卡和矩形框中写入侧的文字等描述共享图像。
非常感谢!
答案 0 :(得分:0)
我在Facebook墙上使用此代码分享文字和图片。它的作品。
从你的oncreate方法调用facebooksharing方法,如下面的代码所示。
CallbackManager callbackManager;
private LoginManager manager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(this.getApplicationContext());
setContentView(R.layout.Your_layout);
callbackManager = CallbackManager.Factory.create();
//call method for sharing post
FaceBookSharing();
}
public void FaceBookSharing() {
List<String> permissionNeeds = Arrays.asList("publish_actions");
manager = LoginManager.getInstance();
manager.logInWithPublishPermissions(this, permissionNeeds);
manager.registerCallback(callbackManager,
new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
PostImage();
}
@Override
public void onCancel() {
System.out.println("onCancel");
}
@Override
public void onError(FacebookException exception) {
System.out.println("onError");
}
});
}
private void PostImage() {
Bitmap image = BitmapFactory.decodeResource(getResources(),
R.drawable.ic_launcher);
SharePhoto photo = new SharePhoto.Builder().setBitmap(image)
.setCaption("Hey this is Demo post!")
.build();
SharePhotoContent content = new SharePhotoContent.Builder().addPhoto(
photo).build();
ShareApi.share(content, null);
Toast.makeText(this, "Succsesfully posted on your wall", Toast.LENGTH_LONG)
.show();
}
&#13;