callback function for when the G1 flips open


Last Updated:

  1. Leolicos

    Leolicos Well-Known Member This Topic's Starter

    Joined:
    Jun 16, 2010
    Messages:
    54
    Likes Received:
    0
    Does there exist a function that hasa callback when the G1 flips open and closed? I'm still a bit new and I'm on the final steps of my first app, doing bug tests and such, and the flip is the only problem I'm having so far.
     

    Advertisement
  2. cp1

    cp1 Well-Known Member

    Joined:
    Apr 30, 2010
    Messages:
    375
    Likes Received:
    35
    Do you want to be notified when the keyboard is flipped open?

    Normally when the keyboard is opened or closed or the orientation is changed the activity is destroyed and a new one is created. So if you have values in edit text boxes that you haven't saved, you will lose them. You should be able to check whether the keyboard is open or not in your oncreate method.

    You can avoid the destruction and recreation of your activity by adding keyboardHidden to configChanges in your manifest. Then instead of destroying and creating your activity itw ill call onConfigurationCHanged instead which you can override and do whatever you want. But, there may be some housekeeping you need to do manually then.
     
    Leolicos likes this.
  3. Leolicos

    Leolicos Well-Known Member This Topic's Starter

    Joined:
    Jun 16, 2010
    Messages:
    54
    Likes Received:
    0
    That worked, but I'm having a problem with my simulator on the computer. It seems when I press "page up" it switches views and toggles from landscape to portrait, but when I read the orientation it's always landscape, same with getRequestedOrientation() at onCreate(), it always returns landscape. Is that just how the simulator works or is there a setting I have to change?
     
  4. Leolicos

    Leolicos Well-Known Member This Topic's Starter

    Joined:
    Jun 16, 2010
    Messages:
    54
    Likes Received:
    0
    That worked, but I'm having a problem with my simulator on the computer. It seems when I press "page up" it switches views and toggles from landscape to portrait, but when I read the orientation it's always landscape, same with getRequestedOrientation() at onCreate(), it always returns landscape. Is that just how the simulator works or is there a setting I have to change?
     

Share This Page

Loading...