Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- call onrestart/onresume when click on back button
- Intent intent = new Intent(Start.this, CitySelect.class);
- View view = TestActivity.group.getLocalActivityManager().startActivity("cityselect", intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
- TestActivity.group.replaceView(view);
- public void replaceView(View v)
- {
- history.add(v);
- setContentView(v);
- }
- @Override
- public void onBackPressed()
- {
- TestActivity.group.back();
- }
- public void back()
- {
- if (history.size() > 0)
- {
- history.remove(history.size() - 1);
- if (history.size() > 0)
- {
- View v = history.get(history.size() - 1);
- setContentView(v);
- }
- else
- {
- finish();
- }
- }
- else
- {
- finish();
- }
- }
- Intent intent = new Intent(Start.this, CitySelect.class);
- View view = TestActivity.group.getLocalActivityManager().startActivity("cityselect", intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
- TestActivity.group.replaceView(view,"cityselect");
- public void replaceView(View v, String activityId)
- {
- history.add(activityId);
- setContentView(v);
- }
- public void back()
- {
- if (history.size() > 0)
- {
- history.remove(history.size() - 1);
- if (history.size() > 0)
- {
- //View v = history.get(history.size() - 1);
- //setContentView(v);
- LocalActivityManager manager = getLocalActivityManager();
- String lastId = mIdList.get(history.size()-1);
- Intent lastIntent = manager.getActivity(lastId).getIntent();
- Window newWindow = manager.startActivity(lastId, lastIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
- setContentView(newWindow.getDecorView());
- }
- else
- {
- finish();
- }
- }
- else
- {
- finish();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement