Android的singletop singleinstance和singletask [英] Android singletop singleinstance and singletask

查看:416
本文介绍了Android的singletop singleinstance和singletask的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在实现不同类型launchmode为不同的活动已经是设计问题。我有5项活动。

I've an design issue in implementing different types of launchmode for different activities. I've 5 Activities.

  1. VideoList

  1. VideoList

VideoDetail

VideoDetail

FavoritesList

FavoritesList

videoSearch这

VideoSearch

的VideoPlayer

VideoPlayer

当用户启动应用程序,它关系到VideoList显示视频列表。点击任何的影片中把他们带到VideoDetails.There是在第二页按钮。播放按钮,添加到收藏夹按钮。我有所有的页面页脚栏。页脚栏包含三个图像按钮。

When the user starts the app it goes to VideoList that displays list of videos. Clicking on any of the Videos take them to VideoDetails.There are two button in that page. Play Button and Add to Favorites Button. I've a Footer bar on all the pages. Footer bar contains three image button.

1 HOME - 将用户带到第一页级视频列表页

1 HOME - Takes the user to first page- video list page

2的收藏夹列表 - 显示收藏夹的视频列表。点击的视频任何一个需要用户的视频信息。

2 FAVORITES LIST - Show the list of favorites video. Clicking on any one of the videos takes the user to video details

3视频搜索 - 用户可以通过艺术家姓名搜索视频。点击的视频任何一个需要用户的视频信息。

3 VIDEO SEARCH - user can search video by artist name. Clicking on any one of the videos takes the user to video details

我的问题是,如果我将所有的活动标准,它吃大量的内存。由于用户可以从每一个页面打开新的活动。

My question is , if I set all the activities to standard, it eats lot of memory. Because user can open new activity from each page.

1。我有哪些选择?

2。我可以用SingleInstance / SingleTop(所有活动或只有一些活动)?

3。我试图SingleTop上的所有活动。它工作正常,在大多数的情况下。除了之一。

一个。用户打开该应用

乙。点击视频列表页的项目之一。它会打开一个新的活动 - VideoDetail

b. Click on one of the item in video list page. It opens a new activity - VideoDetail

℃。从VideoDetail页面,用户点击它会打开一个新的活动FavoritesList收藏列表图像按钮。

c. From VideoDetail page, user clicks the favorites list image button which opens a new activity FavoritesList.

Ð。当用户点击从收藏的影片之一,它不是打开一个新的视频细节,它的关闭收藏夹列表,并可以追溯到详细信息页面。

d. When the user clicks the one of the videos from favorites, its not opening a new video detail, its closing the favorites list and goes back to detail page.

请帮忙

在此先感谢

RM

推荐答案

如果你想使用SingleTop在这种情况下,你需要将code加载从的onCreate <视频细节/ code>到 onResume 作为VideoDetail活动只被创建一次,然后重新开始时的意图尝试再次启动它。

If you want to use SingleTop in this instance then you need to move the code that loads the video details from onCreate to onResume as the VideoDetail activity is only being created once and then resumed whenever an intent tries to launch it again.

这篇关于Android的singletop singleinstance和singletask的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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