Manu Manu - 4 months ago 22
Android Question

How to minimizing android app cache size

my android app cache size is around 40MB when i load the app into device and it is showing blank screen while launching the app for 1st time. i have no idea how to resolve this challenge, please help.

these are the libraries i am using.

compile(group: 'com.microsoft.azure', name: 'azure-notifications-handler', version: '1.0.1', ext: 'jar')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.microsoft.azure.android:azure-storage-android:0.6.0@aar'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'

Answer

You need some sort of splash screen to entertain user while app is loading. But there's a catch... as app is still being loaded how can it run any code to show a splash screen? In fact it can't really, but luckily there's a solution: during the loading time, the window manager draws a placeholder UI for your app, using elements from your theme, such as the background and status bar color. Setting the theme properly allows you to i.e. show static image (no code is loaded yet, so no fancy animation at that point) instantly. The key is to create custom theme that overrides android:windowBackground attribute, and once your app is loaded and starts running, you just replace that theme with your standard one, before calling super.onCreate() in your Activity.

Here's Google+ post of Ian Lake that describes this technique in details: Use cold start time effectively with a branded launch theme.