0

My Application class is simply this

public class DogApplication extends Application {
    private static DogApplication context;

    @Override
    public void onCreate() {
        super.onCreate();
        context = this;
    }

    public static DogApplication getContext(){
        return context;
    }
}

Yet it's taking about 10 seconds before my MainActivity gets called. How do I know? I am logging the timestamp in my Application#onCreate, MainActivity#onCreate start and end. Basically right after the open bracket I log the timestamp and then log again right before the closing bracket. Here is the result of my login:

DogApplication: Start of DogApplication onCreate is 1466143820699 MainActivity: Start of MainActivity onCreate is 1466143820870 MainActivity: TIME TO traverse onCreate is 3260 ms

based on this data MainActivity shouldn't be taking that long to show up. And yet when I install my app, a white screen shows up for about 10 seconds before any view or content is visible. I don't have a splash screen. What might be causing this? I support api 11 and up.

Katedral Pillon
  • 14,534
  • 25
  • 99
  • 199

1 Answers1

0

This issue came in new android studio version due to instant run feature when you disable instant run feature first time launch delay will be gone. To disable instant run see link Instant run in Android Studio 2.0 (how to turn off)

Community
  • 1
  • 1
Khizar Hayat
  • 3,427
  • 3
  • 18
  • 22