我正在打开一个来自SherlockFragment的SherlockActivity。 现在我想用后退按钮构建一个Actionbar。这有效:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myactivity);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
但是我怎么能回到我的Sherlockfragment?这不起作用。错误代码是“无法找到显式活动类”
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case 0:
return true;
default:
// This do NOT bring me back to my SherlockFragment !!! //
Intent in = new Intent(this, MySherlockFragment.class);
startActivity(in);
return super.onOptionsItemSelected(item);
}
}
如何从SherlockActivity中启动Sherlockfragment?
谢谢: - )