Skip to main content

Android Development, Back button function



just want to ask on how to call the Back button of an android phone to go back to previous screen or transaction? because as I hit on the back button of the device the application totally closes. I am building the application through eclipse with PhoneGap.





Could you guys give me an example code or function on how to call the back button to go to previous page?





Thank you guys for your big help.


Comments

  1. If there is nothing to go back to (ie. if the current Activity is the only one in the Stack), the app will close (that is the way Android is designed to work).

    You can call finish() in your Java code (not sure about PhoneGap) to automatically go to the previous Activity.

    Good Luck. (Don't forget to mark correct)

    ReplyDelete
  2. This is really good information I have visited this blog to read something fresh and I really admire you efforts in doing so.

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?