Skip to content

Instantly share code, notes, and snippets.

@SeanPONeil
Created February 9, 2013 22:35
Show Gist options
  • Save SeanPONeil/4747419 to your computer and use it in GitHub Desktop.
Save SeanPONeil/4747419 to your computer and use it in GitHub Desktop.
Dual Pane layout?
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.node_container);
mIsDualPane = getResources().getBoolean(R.bool.has_two_panes);
nid = getIntent().getIntExtra("nid", 0);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
NodeFragment nf = (NodeFragment) getSupportFragmentManager().findFragmentByTag(NodeFragment.TAG);
NodeCommentFragment ncf = (NodeCommentFragment) getSupportFragmentManager().findFragmentByTag
(NodeCommentFragment.TAG);
if(nf == null){
nf = NodeFragment.newInstance(nid);
}
getSupportFragmentManager().beginTransaction().replace(R.id.node_pane, nf, NodeFragment.TAG).commit();
if(ncf == null){
ncf = NodeCommentFragment.newInstance(nid);
}
if(mIsDualPane){
getSupportFragmentManager().beginTransaction().replace(R.id.node_comment_pane, ncf,
NodeCommentFragment.TAG).commit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment