Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Refresh window on Android ?

I have one problem with my app on Android and I don't understand why it doesn't work…

I have one window with a button Login or Logout (if the user is logged or not). When the user click on the login button, it opens a new window where he could log in… When users is logged the login window closes, and the main window appears again…But it impossible to refresh the button (if the user was not logged, button should be logout if login is success…)

With iPhone, I use the focus window event, but this event doesn't work with Android…I've tried with a SetInterval in order to refresh the button, but the interval stops when I go on the login window, and doesn't restart when I go back on the main window…

Have you any ideas to refresh my button ?

Thanks for your help.

— asked August 31st 2010 by Guillaume Ferrand
  • android
  • mobile

2 Answers

  • Can't you just "manually" change the text on the button? I mean, in either the event listener for the button or the function/page it calls change the text of the button with yourButton.text = 'Login' or yourButton.text='Logout'.


    — answered August 31st 2010 by Tim Poulsen
  • Thanks Tim for your answer, but unfortunately my buttons are pics…I want to manage them wjth functions hide() and/or show(), but i don't understand how to do this (how to catch the "event") on Android…

    — answered August 31st 2010 by Guillaume Ferrand
    • You can use a custom event. Define an event listener for the button with a name of your choosing. It would do the image swapping you want. Then, in your logon/logoff code, use the fireEvent() method to trigger that event.


      — commented August 31st 2010 by Tim Poulsen
    • Thanks Tim! Yes it is a good idea. I will try this asap.

      — commented September 1st 2010 by Guillaume Ferrand
    • It's ok! it works fine with the custom event! Thanks Tim!

      — commented September 3rd 2010 by Guillaume Ferrand
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.