Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, I actually found a way to reproduce it. I have an LG with a slide out keyboard, which rotates the home screen when you slide out the keyboard. Once it does that the semi transparent background disappears. It looks like I have to detect some kind of redraw event.</p> <p>I found a work around, or solution, not entirely sure. Either way it solves the problem, at least when I test it with the above mentioned method of reproducing.</p> <p>I implement a service that I keep running permanently, which overrides onConfigurationChanged() method.</p> <p>For ideas see:</p> <ul> <li><a href="https://stackoverflow.com/questions/4247865/button-click-lost-on-widget-when-screen-is-rotated">Button click lost on widget when screen is rotated</a></li> <li><a href="http://developer.android.com/reference/android/content/Intent.html#ACTION_CONFIGURATION_CHANGED" rel="nofollow noreferrer">http://developer.android.com/reference/android/content/Intent.html#ACTION_CONFIGURATION_CHANGED</a></li> </ul> <blockquote> <p>you can not receive this through components declared in manifests</p> </blockquote> <p>This provides solutions for activities, but I am not sure yet how to use something like that in appwidgets, if at all possible:</p> <ul> <li><a href="https://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state">Saving Android Activity state using Save Instance State</a> </li> </ul> <p>Code sample, this service is started in the AppWidgetProvider class in the onEnabled() method. So it's only run once regardless of how many instances of your appwidget are running and should ideally be able to deal with any instance.</p> <p><pre><code>public class ExampleConfigChangeService extends Service { @Override public void onCreate() { super.onCreate(); /* whatever code you need here */ }</p> <p>@Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); /* whatever code you need here */ }</p> <p>/* you need this or it will not compile **/ @Override public IBinder onBind(Intent intent) { /* We don't need to bind to this service */ return null; }</p> <p>@Override public void onConfigurationChanged(Configuration newConfig) { /* * this is the code that will run whenever an ACTION_CONFIGURATION_CHANGED happens * do whatever needs to be done, such as re-reading preferences, * resetting background to user's preferred setting etc. */ } }</pre></code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload