slk
slk

Reputation: 46

Android flickering screen in 4.2 with no apparent reason

I'm developing an application for android and when everything should be finished I've found an extrange behaviour. In some devices the screen starts to flicker, and there is no apparent reason for that. It may happen in initial splash with only an AsyncTask quering a webservice or in the home screen with no asynctask at all.

It's strange because only happens in devices with android 4.2, nor in 2.3 or 2.2. I've tried enabling the tag harware-accelration in manifest but I've no clue for what can be the reason

Some help?

Thanks in advance.

Upvotes: 0

Views: 737

Answers (1)

slk
slk

Reputation: 46

Finally I've managed how to avoid this. Here was the trick, just changing my Application's Override OnConfigurationChanged. This was my old code

@Override
    public void onConfigurationChanged(Configuration newConfig) {       
        super.onConfigurationChanged(newConfig);
        Locale l = getLocale();
        Configuration config = new Configuration(newConfig); // get Modifiable Config from actual config changed
        config.locale = l;
        getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());

    }

and I've changed to this

@Override
    public void onConfigurationChanged(Configuration newConfig) {       
        super.onConfigurationChanged(newConfig);
        Locale l = getLocale();         
        Configuration config = new Configuration(newConfig); // get Modifiable Config from actual config changed
        config.locale = l;
        getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());

    }

I hope someone finds this useful.

Upvotes: 2

Related Questions