Funny .... Here's a very recent article on this:
http://android.cyrilmottier.com/?p=873
On Friday, February 1, 2013 2:08:54 AM UTC+8, Kostya Vasilyev wrote:
>
> I see this in every app with theme switching, mine included.
>
> My guess is that when Android performs an activity launch "from nothing",
> it runs the launch animation using whatever theme is specified in the
> manifest, before any of the app's code is executed.
>
> You can easily test this by setting a title for your activity in the
> manifest, and then setting a different one in your onCreate. You should see
> the title change (flash) after the animation completes.
>
> It works differently in Chrome, where the launch animation has the "recent
> sites" tiles (Chrome does not have a light/dark theme, but we're talking
> about being able to control the launch animation).
>
> I believe the reason for this is they handle the back key and use
> moveTaskToBackground rather than letting the activity get destroyed.
>
> Again, easy to test: 1) kill Chrome in the app manager, relaunch, watch
> the first launch animation after that, it'll be just white without the
> "recent sites" tiles 2) press Back in Chrome, use "adb shell dumpsys
> activity activities" and you'll see the main Chrome activity in
> state=STOPPED, not destroyed.
>
> And actually, it looks like it's not just Chrome....
> DialtactsActivity.java (in Contacts):
>
> @Override
> public void onBackPressed() {
> if (mInSearchUi) {
> // We should let the user go back to usual screens with tabs.
> exitSearchUi();
> } else if (isTaskRoot()) {
> // Instead of stopping, simply push this to the back of the
> stack.
> // This is only done when running at the top of the stack;
> // otherwise, we have been launched by someone else so need to
> // allow the user to go back to the caller.
> moveTaskToBack(false);
> } else {
> super.onBackPressed();
> }
> }
>
> The tradeoff is of course a somewhat higher memory usage, and potentially
> emails from users asking "why does your activity keep running, it's really
> affecting my battery and has been proven to cause baldness and insomnia".
>
> -- K
>
> On Thursday, January 31, 2013 8:35:32 PM UTC+4, Pent wrote:
>>
>> Tearing my hair out over this one.
>>
>> I'm offering the user a choice of several dark or light themes.
>> Setting with getApplication().setTheme() and setTheme() in onCreate of
>> activity
>> (as the first thing in that function).
>>
>> There's a period while the app loads when the screen goes black. If
>> you have a light desktop, it's very disconcerting (flashes). Of course
>> I could set a fixed white theme in the manifest, but then the inverse
>> problem occurs when user selects a dark theme.
>>
>> Tried everything I can think of e.g. overrode Application, set in
>> Application:onCreate, created a FrontDoor activity that just sets the
>> theme then loads the relevant dedicated Light or Dark activity.
>>
>> It appears Application:setTheme is completely ignored.
>>
>> The current best solution I have is to set a manifest theme with a
>> grey background. Could create dedicated Dark and Light launcher icons,
>> but
>>
>> Any tips ?
>>
>> Pent
>>
>> p.s. tried setting a transparent application theme in the manifest,
>> then you can get a huge delay while data loads. And if Android is
>> short of memory the user keeps seeing the desktop in-between
>> activities.
>>
>
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.