Titanium Community Questions & Answer Archive

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

How can I control a default back button on android?

Hello.
In my application, I don't want an user to use a default back button on android.
So I want to limit a function of a default back button on android.
How can I do it?

— asked October 29th 2010 by masa ochi
  • android
0 Comments

9 Answers

  • Accepted Answer

    Masa

    There is a lot of confusion here, I think because you are answering your own question rather than using the comment facility to respond to peoples' suggestions. I will try to answer all of the points/issues that you have made in various "answers".

    Firstly, the ticket that was raised to track the functionality you need is #1641. From the ticket you can determine that the code was added at commit d62b2f33f5d5397758b0.

    As I have cloned the repo, I can run the following git command locally to see a list of branches in which the functionality was added:

    git branch --contains d62b2f33f5d5397758b0
    

    Thus, I can tell you that the hardware button functionality is indeed available in branch 1.4.X.

    You may download the latest build of 1.4.X from here. Note the dropdown list at the top left-hand side to switch between 1.4.X and master (which is currently also known as 1.5.0, but obviously in the future it will refer to later revision numbers).

    Install it using these instructions. Personally, I rename the directory to include the date that I installed it, so that I can revert back to an earlier "latest build" of 1.4.X if there is any odd behaviour with the latest. Restart TiDev (I can't remember if this step is actually required). You will then get a new option in TiDev, as in this screenshot.

    If this resolves your issue, your last step is to simply mark an answer as your best one, to close this thread.

    Good luck!

    — answered November 10th 2010 by Paul Dowsett
    permalink
    2 Comments
    • What should I do with "d62b2f33f5d5397758b0"?
      I can't understand.
      Would you tell me?

      — commented November 11th 2010 by masa ochi
    • After installing SDK 1.4.X, "android:back" worked!
      Thank you very much!!!

      — commented November 11th 2010 by masa ochi
  • This should do the trick, WARNING!!!! you must have SDK 1.5.0 of Titanium this supports the android:back event.

    var win = Ti.UI.currentWindow;
    
    win.addEventListener('android:back',function(){
    return false;
    });
    
    — answered October 29th 2010 by Jacob van Dam
    permalink
    0 Comments
  • I don't know whether I have SDK 1.5.0 of Titanium or not.
    Please tell me how I check.
    And if I don't have it, please tell me how I get it.

    — answered October 29th 2010 by masa ochi
    permalink
    0 Comments
  • I don't know whether I have SDK 1.5.0 of Titanium or not.
    Please tell me how I check.
    And if I don't have it, please tell me how I get it.

    — answered October 29th 2010 by masa ochi
    permalink
    0 Comments
  • I don't know whether I have SDK 1.5.0 of Titanium or not.
    Please tell me how I check.
    And if I don't have it, please tell me how I get it.

    — answered October 29th 2010 by masa ochi
    permalink
    0 Comments
  • You can download the latest from: http://builds.appcelerator.com.s3.amazonaws.com/index.html

    Select master. But you don't have any support for it yet!

    — answered October 29th 2010 by Jacob van Dam
    permalink
    0 Comments
  • How should I use it?
    I don't know what it is.

    — answered October 29th 2010 by masa ochi
    permalink
    0 Comments
  • See http://developer.appcelerator.com/doc/mobile/get_continuous_builds for info on how to use the nightly builds. BTW, I've been using the android:back functionality with the 1.4.x nightly builds for quite a while and it works fine (published/selling app)

    — answered October 30th 2010 by Tim Poulsen
    permalink
    0 Comments
  • When I download SDK 1.5.0 according to http://developer.appcelerator.com/doc/mobile/get_continuous_builds, a screen of a test tab doesn't appear.
    And after download SDK 1.4.1.1, the screen appear, but 'android:back' doesn't work.
    I don't know why and what I should do.
    Please tell me.

    — answered November 1st 2010 by masa ochi
    permalink
    1 Comment
    • This is a comment, not an answer, Masa!

      — commented November 10th 2010 by Paul Dowsett
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.