简体   繁体   中英

How to implement Application.ActivityLifecycleCallbacks to make a splash screen for an Android app using the android:windowBackground method

Android Studio Intermediate here with what I hope is not a redundant question:

I encountered an issue while building a splash screen for the very first time. I'm following the process posted here by David Medenjak, which encourages to use a theme in order to have it be displayed while the app is in the process of booting up:

https://blog.davidmedenjak.com/android/2017/09/02/splash-screens.html

I followed this very closely and am certain everything should be in order.

The very last step for basic functionality, titled "Registering the Splash Screen", suggests building a java file to handle switching to your application once it finishes loading. The java code provided on the blog implements an abstract class called Application.ActivityLifecycleCallbacks, yet the code provided does not implement the obstract methods of this superclass.

I did some research on how to implement this superclass but I'm not familiar with it enough to know how to do so and retain the functionality I need. My java class looks just like the one described in the blog.

Here is another guide on this superclass I found to help with implementing, which implements very few methods:

https://medium.com/@mobile_develop/android-application-development-detecting-when-your-app-enters-the-background-or-foreground-bbced47ad8a5

I apologize if the answer is obvious. My hope is to communicate with David, since he's active on StackOverflow. Maybe @'ing him to this thread would work. Any tips on how to implement the class (if necessary) would be greatly appreciated.

For the abstract methods that are not implemented in the super class, simply implement them as empty method definitions. The Example you can refer to is the following from the blog author's included source .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM