如何从片段分享图像到Facebook

时间:2015-06-20 14:41:39

标签: android android-fragments share facebook-sdk-4.0

我使用的是Facebook SDK,我想知道如何在片段中使用share

public class FullScreenImageAdapter extends PagerAdapter {

private Activity _activity;
private ArrayList<String> _imagePaths;
private LayoutInflater inflater;
public CallbackManager callbackManager;
public LoginManager loginManager;
// constructor
public FullScreenImageAdapter(Activity activity,
        ArrayList<String> imagePaths) {
    this._activity = activity;
    this._imagePaths = imagePaths;
}

@Override
public int getCount() {
    return this._imagePaths.size();
}

@Override
public boolean isViewFromObject(View view, Object object) {
    return view == ((RelativeLayout) object);
}

@Override
public Object instantiateItem(ViewGroup container, int position) {
    TouchImageView imgDisplay;
    Button btnClose;



    inflater = (LayoutInflater) _activity
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View viewLayout = inflater.inflate(R.layout.full_photo, container,
            false);

    FacebookSdk.sdkInitialize(_activity.getApplicationContext());
    callbackManager = CallbackManager.Factory.create();
    List<String> permissionNeeds = Arrays.asList("publish_actions");
    //this loginManager helps you eliminate adding a LoginButton to your UI
    LoginManager manager = LoginManager.getInstance();
    manager.logInWithPublishPermissions(this, permissionNeeds);*// It Problem

It Problem manager.logInWithPublishPermissions(this,permissionNeeds)无法解析方法

问题super.onActivityResult它无法重新载入

 @Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);

}

请帮助我或解决这里的解决方案抱歉我的英语不足

0 个答案:

没有答案