Android的活动之间的切换 [英] Switching between Android activities

查看:120
本文介绍了Android的活动之间的切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个Android应用程序,我会想3活动(比如家庭,地图和照片)之间切换。眼下流量像首页>地图>照片。我想,以允许用户对这些3活动之间切换。说,如果他想从照片去地图或照片首页不破坏照片的活动。什么是Android中实现这一目标的最佳途径?

I am working on an Android application where I would want to switch between 3 activities (say Home, Map and Photo). Right now the flow is like 'Home>Map>Photo'. I would like to allow the user to switch between these 3 activities. Say if he wants to go from Photo to Map or from Photo to Home without destroying the Photo activity. What is the best way in Android to achieve this?

我通过其他的答案继续左右,但它似乎是缓存数据的地方是不破坏其它功能,唯一可行的方法(对于前。后退按钮)。

I went through other answers on SO but it seems like caching the data somewhere is the only feasible way which does not break other functionality (For ex. back button).

- 编辑 -

我想这个工作完全一样TabHost的工作方式。将AP preciate有关如何实现这一目标的任何想法。

I want this to work exactly like the way TabHost works. Will appreciate any ideas about how to achieve that.

推荐答案

好了,这就是我最后做一次活动结束恢复状态。

Ok, so this is what I ended up doing to restore the state once the activity finishes.


  • Store中活动的共享preferences所有的原始变量。

  • 将图像存储为文件。

  • 请问如果需要使用SQLite。

我也看了一下 db4o的机器人但不知道是否会使用它。

I also looked at db4o android but not sure whether I'll use it.

这篇关于Android的活动之间的切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆