I've been working on an application recently and when I added some animations I started getting the Skipped XX frames, too much work on main thread warning. I optimized the images, moved as much as I could into AsyncTasks and I still get the warning. My onCreate function is as follows:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
userDetailsHandler = new UserDetailsHandler(this, null, null, 1);
userDbHandler = new UserDBHandler(this, null, null, 1);
userService = new UserServiceImpl();
new IsLoggedIn().execute();
setContentView(R.layout.activity_main);
logo = (AppCompatImageView) findViewById(R.id.logo);
Glide.with(this).load(R.drawable.logo).fitCenter().into(logo);
container = (FrameLayout) findViewById(R.id.container);
container.setVisibility(android.view.View.INVISIBLE);
new FadeInAnimation().execute(container);
loginFragment = new LoginFragment();
registerFragmentOne = new RegisterFragmentOne();
registerFragmentTwo = new RegisterFragmentTwo();
facebookLoginFragment = new FacebookLoginFragment();
getSupportFragmentManager().beginTransaction().add(R.id.container, loginFragment).commit();
user = new User();
}
The logo drawable is a 74KB PNG. Why am I still getting the Too much work on main thread warning? Is it possible this happens because of some of the custom typefaces I'm using? Does the fact that I'm running it in an AVD add to the problem?