Answer Activity에서 this.finish()를 호출하면 질문 활동으로 돌아갑니다. 그리고 질문 활동에서 startActivityForResult로 AnswerActivity를 시작하십시오. 그러면 응답이 완료되면 질문 활동에 통지되어 새로운 질문 등을 표시 할 수 있습니다. 그러면 각 AnswerActivity가 삭제됩니다. 도움이 필요하면 코드 샘플을 게시하십시오. 이런 식으로 설계한다면 스택에서 활동을 찾을 필요가 없습니다.
질문 활동
this.startActivityForResult(Intent, requestCode); // somewhere in your code to launch the Answer Activity
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// now we have returned from the AnswerActivity and it has been destroyed
// do any processing here on the answer or show a new question.
}
대답 활동
public void onBackClick(View v) {
//on click handler for a back button or something.
this.setResult(resultCode, Intent /* some data to give back to parent */);
this.finish();
}
감사를 작동하지 않습니다. 참조 할 수 있도록 모든 코드 스 니펫을 게시 할 수 있습니까? 나는 이것 모두에 아주 새다. – Somk
코드 샘플을 추가하도록 업데이트 됨 –