Code example for FragmentActivity

Methods: startActivityForResult, useDualPane

0
	public static boolean useDualPane(Context context) {
		return Utils.useDualPane(context, 2, 3);
	} 
	 
	public boolean useDualPane() { 
		return useDualPane(this);
	} 
	 
	void showPost(int post_id, int post_xid) {
		if (postviewFrag != null)
			if (postviewFrag.getPostId() == post_id && postviewFrag.getPostXid() == post_xid)
				return; 
				 
		postviewFrag = new PostViewFragment();
		Bundle args = new Bundle();
		args.putInt("id", post_id);
		args.putInt("xid", post_xid);
		args.putString("board", pref.getString("board", ""));
		postviewFrag.setArguments(args);
		 
		FragmentManager fm = getSupportFragmentManager();
		fm.beginTransaction().replace(R.id.postlist_right, postviewFrag).commit();
	} 
 
	@Override 
	public void onPostSelected(PostItem post) {
		if (useDualPane()) { 
			showPost(post.id(), post.xid());
		} else { 
			Intent intent = new Intent(this, PostViewActivity.class);
			intent.putExtra("id", post.id());
			intent.putExtra("xid", post.xid());
			intent.putExtra("board", pref.getString("board", ""));
			startActivityForResult(intent, ACTION_VIEW_POST);
		} 
	} 
	 
	@Override 
	public void onActivityResult(int request, int result, Intent intent) {