Splash in activity or thread?

北慕城南 提交于 2019-12-25 01:49:13

问题


So I've currently been using splash in a thread and now I consider using it in an activity instead. The reason I used it in a thread was to do stuff in the background while it was displayed.

The reason I'm considering using an activity instead is that I'll be able to show the splash in fullscreen and then when I switch to my main activity let the notification bar be displayed again. I'll off course use the splash activity to do all possible background data.

This is not a question about how to implement but rather the cons and pros of this approach, all feedback is greatly appreciated.


回答1:


Cons of using a splash screen

  1. It is orthogonal to how Android apps usually operate

    If you haven't noticed, almost none of the built-in apps have splash screens (the only prominent example is Google Maps Navigation). Generally apps are designed to show a screen to the user immediately then load data in while presenting the user with some options (see Google Maps).

  2. It is annoying to users

    Splash screens make the top of the list on What are common UI misconceptions and annoyances?

I say this as a user of apps who is often put off by splash screens. They are especially bothersome because I want to switch apps rapidly and they prevent me from doing so.

Perhaps you could implement a scheme where you display your main page, and have a widget on that page showing the loading progress. That is more user friendly in my opinion. Your goal should be get out of onCreate as soon as possible leaving a responsive UI for the user. The Amazon Appstore is a good example: it shows all the headers and then loads in the apps and images while you play around with things.

If have no choice

Pros of using a Thread for a splash screen

  1. It simplifies concerns over lifecycle

    If you use an Activity, you will have to make sure it is not on the stack so that users cannot navigate back to it (Android: 'Splash screen' only once).

  2. It simplifies the logic of starting this activity

    You won't have to worry about when or where to start the splash Activity. Your other Activities can call the Activity with a splash screen normally, and you won't have to switch back and forth between the splash Activity and your actual activity

  3. You don't have to worry about the splash Activity as an entity

    It just leaves you with an Activity that takes longer to start up



来源:https://stackoverflow.com/questions/8432062/splash-in-activity-or-thread

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!