You are just lucky that this happens to work, and there are many things you
can do in your activity that will utterly break if you do this.

On Wed, Aug 5, 2009 at 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
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
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