When your activity launches, and when it relaunches, it calls onResume
(). Some things, like setContentView(), you will want to put in
onCreate(). But depending on how you do your localization, you might
be able to put it in a function called "localize()" and then call that
from onResume().



Yusuf Saib
Android
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Aug 5, 11:54 pm, Ronald Pompa <[email protected]> wrote:
> I figured a way to reload the activities. simply call this.onCreate
> (null); to reload the current activity.
>
> For example if you have a hierarchy like me: MainActivity ->
> PreferenceActivity and make a change in preferences, i listen for a
> change and with onSharedPreferenceChanged and call this.onCreate
> (null). When we go back, we need to reload the MainActivity, onResume
> () will be called so we put this.onCreate(null) there too and that
> should be enough.
>
> It works for my solution for changing the locale for the application.
>
> Hope it helps!
>
> // Ronald
>
> On Jul 19, 1:24 pm, Anders Aagaard <[email protected]> wrote:
>
>
>
> > Hi
>
> > I have an application, where I need to change the language through a
> > settings menu.  Now this part works perfectly, but it doesn't change
> > the language for activities that have gone through onCreate.
>
> > I got a TabHost, and 2 tabs in it, from the tabs you can get to
> > settings.
>
> > Refreshing the TabHost isn't an issue, as it's fairly small, however
> > both the 2 tabs are quite large views, and having a function to
> > manually update all the strings seem unnecessarily difficult.  Is
> > there any way to force theactivityto recreate itself and trigger a
> > new onCreate?
>
> > I tried having a static function in the tabhost that clears all tabs
> > and recreates them, this refreshes the tab titles, but not the content
> > in the tabs.
>
> > Anders Aagaard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to