Search code examples
androidwidgetwifi

How to know whether the Orientation of the screen have changed or not when extends an AppWidgetProvider?


I am trying to create an WiFi widget for ICS supported devices. In ICS home screen orientation is supported, so while changing the orientation my widget becomes inactive(hanged). By doing the research I found that we need to re-assign the remoteView while changing the orientation. How to found whether the orientation have changed or not?. If I am extending the activity then I have Overridden method onConfigurationChanged, but here i am extending AppWidgetProvider. How I can solve this problem.

Thanks in advance.


Solution

  • create an application to override onConfigurationChanged method:

    public class WifiApp extends Application {
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        //here u can check the ori
    }
    ...