Source:
public void onCreate(Bundle savedInstanceState) { Intent i = getIntent(); asw = CommCareApplication._().getCurrentSessionWrapper(); session = asw.getSession(); String passedCommand = getIntent().getStringExtra(SessionFrame.STATE_COMMAND_ID); Vector<Entry> entries = session.getEntriesForCommand(passedCommand == null ? session.getCommand() : passedCommand); prototype = entries.elementAt(0); if (entries.size() == 1 && (prototype.getXFormNamespace() == null || prototype.getXFormNamespace().equals(""))) { mViewMode = true; } factory = new NodeEntityFactory(session.getDetail(getIntent().getStringExtra(EntityDetailActivity.DETAIL_ID)), asw.getEvaluationContext()); mTreeReference = SerializationUtil.deserializeFromIntent(getIntent(), EntityDetailActivity.CONTEXT_REFERENCE, TreeReference.class); String shortDetailId = getIntent().getStringExtra(EntityDetailActivity.DETAIL_PERSISTENT_ID); if(shortDetailId != null) { Detail shortDetail = session.getDetail(shortDetailId); this.mEntityContext = new Pair<Detail, TreeReference>(shortDetail, mTreeReference); } entity = factory.getEntity(mTreeReference); super.onCreate(savedInstanceState); this.detailIndex = i.getIntExtra("entity_detail_index", -1); if (this.getString(R.string.panes).equals("two")) { if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { this.setResult(RESULT_CANCELED, this.getIntent()); this.finish(); return; } } try { next.setOnClickListener(new OnClickListener() { public void onClick(View v) { select(); } }); if (mViewMode) { next.setText("Done"); } mDetailView.setRoot((ViewGroup) container.findViewById(R.id.entity_detail_tabs)); mDetailView.refresh(factory.getDetail(), mTreeReference, detailIndex, true); } catch(SessionUnavailableException sue) { } mDetailView.setDetail(factory.getDetail()); }

Target:
public void onCreate(Bundle savedInstanceState) { Intent i = getIntent(); asw = CommCareApplication._().getCurrentSessionWrapper(); session = asw.getSession(); String passedCommand = getIntent().getStringExtra(SessionFrame.STATE_COMMAND_ID); if (passedCommand != null) { mViewMode = session.isViewCommand(passedCommand); } else { mViewMode = session.isViewCommand(session.getCommand()); } factory = new NodeEntityFactory(session.getDetail(getIntent().getStringExtra(EntityDetailActivity.DETAIL_ID)), asw.getEvaluationContext()); mTreeReference = SerializationUtil.deserializeFromIntent(getIntent(), EntityDetailActivity.CONTEXT_REFERENCE, TreeReference.class); String shortDetailId = getIntent().getStringExtra(EntityDetailActivity.DETAIL_PERSISTENT_ID); if(shortDetailId != null) { Detail shortDetail = session.getDetail(shortDetailId); this.mEntityContext = new Pair<Detail, TreeReference>(shortDetail, mTreeReference); } entity = factory.getEntity(mTreeReference); super.onCreate(savedInstanceState); this.detailIndex = i.getIntExtra("entity_detail_index", -1); if (this.getString(R.string.panes).equals("two")) { if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { this.setResult(RESULT_CANCELED, this.getIntent()); this.finish(); return; } } try { next.setOnClickListener(new OnClickListener() { public void onClick(View v) { select(); } }); if (mViewMode) { next.setText("Done"); } mDetailView.setRoot((ViewGroup) container.findViewById(R.id.entity_detail_tabs)); mDetailView.refresh(factory.getDetail(), mTreeReference, detailIndex, true); } catch(SessionUnavailableException sue) { } mDetailView.setDetail(factory.getDetail()); }