在我的应用程序类中,我正在注册BroadcastReceiver
以监听应用程序区域设置更改,并且它正常工作,因为我更改了区域设置它运行良好,但我想关闭我的应用程序,从它创建它。我试图玩上下文但没有成功。
public class MyApp extends MultiDexApplication {
....
private BroadcastReceiver myReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String locale = Locale.getDefault().getCountry();
// Toast.makeText(context, "LOCALE CHANGED to " + locale,
// Toast.LENGTH_LONG).show();
/* Destroy Here */
}
};
@Override
public void onCreate() {
super.onCreate();
.........
..........
IntentFilter filter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED);
registerReceiver(myReceiver, filter);
}
}