Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to minimize an android app's cache size

My android app cache size is around 40 MB when I load the app into the device, and it is showing blank screen while launching the app for 1st time.

How do I resolve this?

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'
like image 769
Manu Avatar asked Feb 03 '26 02:02

Manu


2 Answers

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.

like image 110
Marcin Orlowski Avatar answered Feb 05 '26 16:02

Marcin Orlowski


I would try this guide You probably cant put an animation there, but showing some resource rather than the black/white screen when your app loads up first time sounds good.

like image 20
parohy Avatar answered Feb 05 '26 16:02

parohy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!