을 선호하는 것입니다.
첫 번째 조각에는 카메라 버튼이있는 레이아웃이 있습니다. 두 번째 조각에는 미리보기가 있고 두 개의 단추는 수락/취소합니다.
backstack을 사용하면 취소 (또는 사용자가 뒤로 밀기)하면 첫 번째 조각으로 되돌아 갈 수 있습니다. 여기
다른
// Create new fragment and transaction
Fragment newFragment = new ExampleFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack
transaction.replace(R.id.fragment_container, newFragment);
transaction.addToBackStack(null);
// Commit the transaction
transaction.commit();
와 조각을 대체하기 위해 버튼을 수 있습니다 취소 귀하의 방법을 보여주는 조각 튜토리얼 코드 (http://developer.android.com/guide/components/fragments.html)입니다 팝업 스택을 pop 스택 (popBackStack() (사용자가 Back 명령을 시뮬 레이팅)으로 파쇄합니다.
다른 옵션이 있습니다. 미리보기의 사용자 정의 레이아웃이 필요하지 않은 경우 사용자 정의 카메라를 사용하지 않고 startActivityForResult를 사용하여 카메라를 의도로 열면됩니다. 인 텐트를 사용하면 사진을 찍을 수 있으며 (이 경우 결과 사진은 주요 활동과 통신 함) 사진을 찍지 않고 앱으로 돌아가는 취소 버튼도 있습니다.