안드로이드 개발 질문/답변
(글 수 45,052)
private ArrayList<View> history;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.history = new ArrayList<View>();
group = this;
// Start the root activity withing the group and get its view
View view = getLocalActivityManager().startActivity("ShopActivity", new
Intent(this,ShopActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
// Replace the view of this ActivityGroup
replaceView(view);
}
public void replaceView(View v) {
// Adds the old one to history
history.add(v);
// Changes this Groups View to the new View.
setContentView(v);
}
history 배열에 뷰를 넣고 백키를 눌렀을때 history 의 갯수를 하나 줄여서 나오는걸 다시 setContentView 를 이용해 화면에 보여주게
되는데..
문제는 이렇게 사용하면 onresume 의 반응이 없습니다.
이 문제를 보완하고자 배열에 들어있는 뷰를 가져와서 뷰가 만들어진 activity or class 의 메서드를 호출 할 수 있을까요?




히스토리에 view를 직접 넣기 보다 intent를 넣어두시고...
히스토리에서 빼낸 intent로 localActivityManager를 이용해 View를 가져오시고, 그걸 setContentView실행하는 식으로 하시죠.