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?
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!
-
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; });
-
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. -
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. -
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. -
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!
-
How should I use it?
I don't know what it is. -
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)
-
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.