开发者

Android singletop singleinstance and singletask

开发者 https://www.devze.com 2022-12-21 00:59 出处:网络
I\'ve an design issue in implementing different types of launchmode for different activities. I\'ve 5 Activities.

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

  1. VideoList

  2. VideoDetail

  3. FavoritesList

  4. VideoSearch

  5. VideoPlayer

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 - Takes the user to first page- video list page

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

3 VIDEO SEARCH - user can search video by artist name. Cl开发者_JAVA百科icking 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. What are my choices?

2. Can I use SingleInstance / SingleTop (on all activities or only some activity )?

3. I tried to SingleTop on all activities. It works fine on most of the cases. Except for one.

a. User opens the app.

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

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.

Please help

Thanks in advance

RM


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号