Starting with API level 5, you can override onBackPressed().
For previous API levels, use something like:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// your code here
return true;
}
return super.onKeyDown(keyCode, event);
}
Whether this is a good idea is another question.
Also note that the user can still use the Home key to leave the activty,
and you can't override that.
-- Kostya
22.12.2010 14:49, vikram jain ?????:
use back.setVisible(false)
On Wed, Dec 22, 2010 at 5:18 PM, Abhilash baddam
<[email protected]
<mailto:[email protected]>> wrote:
Hi friends,
Suppose i have an activity which displays a text
like hello..when the user click on back button i don't want
to work that key instead i want to display a toast which
shows back button not works here . How can we disable that
key programmatically.
Any suggestions please...
Regards,
Abhilash.B
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>
To unsubscribe from this group, send email to
[email protected]
<mailto:android-developers%[email protected]>
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en