I want to know how to achieve this effect.
My app (default everything), when launcher icon is clicked, right away display some kind of a empty dummy window, where nothing is happening and then loads layout into it.
"Heavier" apps like YouTube, Drive, Dropbox etc. when started, seem to wait after launch, without showing that dummy window and load right into ready layout.
Any idea how to do this or where should I look into?
Thanks
//EDIT: this has nothing to do with something like loading database, where I should display progressBar, imho this has to do with stuff before activity exists.
On the right hand side under properties, you will find the background attribute. Clicking on this and choosing custom will allow you to define the RGB value to override the white screen. After following these steps, your app will now no longer show the annoying white screen on either Android or iOS.
In android, by pressing a back button or home button. So put an event key listener for back & home button and terminate the service.
Answer: (d) contextWrapper. Explanation: The android.app.Service is subclass of ContextWrapper class. Android service is a component used to perform operations on the background, such as playing music, handling network transactions, interacting content providers, etc.
I suggest you don't disable the dummy loading window using:
<style name="Theme.MyTheme" parent="android:style/Theme" > .... <item name="android:windowDisablePreview">true</item> .... </style>
because you could run into several problems. For example, if you try to animate an AlertDialog, enter animation will not work (personal experience).
The right solution is to set the theme of your application like to your main activity screen (same ActionBar style, same background color). In my application after severals experiments i found the right solution for my needs. (I have a main activity with blank background, no ActionBar, just full screen personal layout)
1 - styles.xml: add new style like this (remove ActionBar and set the same background color of my main activity)
<style name="LoadingTheme" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen"> <item name="android:windowBackground">@color/white_smoke</item> </style>
2 - AndroidManifest.xml: set my theme for main activity to "LoadingTheme"
<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.company.appname.MainActivity" android:label="@string/app_name" android:theme="@style/LoadingTheme"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> .... </application>
And finally i have full blank dummy loading window without ActionBar with soft MainActivity load and working animations.
Hope to be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With