1

I have a scenario where I am in the middle of my android app flow and now user changes the language of the device. In this case I need to navigate user to MainActivity but I couldn't find any good way to detect the language change on each activity. To detect lang change for a single activity, I tried comparison way but please suggest any good way to handle it over all the activities. And one more point, please suggest how will I remove the backstack while navigating back to MainActivity from middle of the flow.

Apurva Sharma
  • 191
  • 2
  • 7
  • Have a look at these link http://stackoverflow.com/questions/9296372/how-to-get-notified-when-system-locale-changes-in-android http://stackoverflow.com/questions/8049207/how-to-refresh-activity-after-changing-language-locale-inside-application – justHooman Aug 12 '15 at 08:01

1 Answers1

1

Before a user change language, he must go to android settings, so your app doesn't active in this moment (all your activities stopped). When the user return to your app, in top activity called onStart(). You can check language in onStart() method for each activity.

Sory for my bad english

mlevytskiy
  • 1,555
  • 2
  • 16
  • 26
  • I don't want to make a check in each activity...as it is a bad practice. That is why I put the question here. – Apurva Sharma Aug 12 '15 at 08:36
  • @ApurvaSharma if you implement that feature in a _BaseActivity_'s onStart() which your other activity are extending then you don't implement in every one. – ben-efiz Aug 12 '15 at 08:52