How to detect orientation change in home screen widget?
Posted
by kknight
on Stack Overflow
See other posts from Stack Overflow
or by kknight
Published on 2010-03-12T20:10:11Z
Indexed on
2010/03/12
20:47 UTC
Read the original article
Hit count: 374
android
I am writing a home screen widget and want to update the home screen widget when the device orientation changes from portrait to landscape or the other way. How can I make it?
Currently, I tried to reigster to CONFIGURATION_CHANGED action like the code below, but the Android didn't allow me to do that by saying "IntentReceiver components are not allowed to register to receive intents". Can someone help me? Thanks.
public class MyWidget extends AppWidgetProvider {
@Override
public void onEnabled(Context context) {
super.onEnabled(context);
this.registerReceiver(this, new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED));
}
© Stack Overflow or respective owner