Android 如何从活动中打开片段(使用ABS)

Android 如何从活动中打开片段(使用ABS),android,actionbarsherlock,fragment,slidingmenu,Android,Actionbarsherlock,Fragment,Slidingmenu,我正在为我的应用程序使用Action Bar Sherlock片段。我需要从活动中找到碎片。但当我使用此代码进入片段时,滑动菜单不起作用 活动代码 Intent notificationIntent = new Intent(context,FragmentOpenActivity.class); 碎片的活动就像 public class FragmentOpenActivity extends SherlockFragmentActivity { private Bundle i_fragm

我正在为我的应用程序使用Action Bar Sherlock片段。我需要从活动中找到碎片。但当我使用此代码进入片段时,滑动菜单不起作用

活动代码

Intent notificationIntent = new Intent(context,FragmentOpenActivity.class);
碎片的活动就像

public class FragmentOpenActivity extends SherlockFragmentActivity {
private Bundle i_fragment;
private String messages = null;
private String coupons = null;
private String yo = null;
private String invitation = null;
private String loyalty = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    if (savedInstanceState == null) {
        // getSupportFragmentManager().beginTransaction()
        // .add(android.R.id.content, new MessagesFragment()).commit();
        i_fragment = getIntent().getExtras();
        if (i_fragment == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(android.R.id.content, new ProfileEditorFragment())
                    .commit();
        } else {
            messages = i_fragment.getString("Message");
            coupons = i_fragment.getString("Coupon");
        }
        if (messages != null && messages.equalsIgnoreCase("Message")) {
            getSupportFragmentManager().beginTransaction()
                    .add(android.R.id.content, new MessagesFragment())
                    .commit();
        } else if (coupons != null && coupons.equalsIgnoreCase("Coupon")) {
            getSupportFragmentManager().beginTransaction()
                    .add(android.R.id.content, new CouponsFragment())
                    .commit();
        } else {
            getSupportFragmentManager().beginTransaction()
                    .add(android.R.id.content, new ProfileEditorFragment())
                    .commit();
        }
    }
}

/**
 * @return Displaying Action Bar Button with Image
 */
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    return true;
}

/**
 * @return Click Events for Action Bar Buttons
 */
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
    case android.R.id.home:
        startActivity(new Intent(this, FragmentChangeActivity.class));
        break;
    }
    return true;
}

/**
 * @return Handling Back button
 */
public void onBackPressed() {
    startActivity(new Intent(this, FragmentChangeActivity.class));
    finish();
}
}

Please refer the following code for fragment 

public class CouponsFragment extends SherlockFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        getSherlockActivity().getSupportActionBar().setDisplayOptions(
                ActionBar.DISPLAY_SHOW_CUSTOM);
        getSherlockActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(
                true);
return inflater.inflate(R.layout.listview_refreshable, null);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
    }

    public void onStart() {
        super.onStart();

}
}
正常情况下,滑动菜单工作正常,但当我来自
FragmentOpenActivity
时,它没有响应。请给我找个解决办法