Android details disable return key

Source: Internet
Author: User
In today's project, we need to use the return key in my Actionbar, which is the last time I recorded my father's activity.

Android.support.PARENT_ACTIVITY

For details, please visit: http://blog.csdn.net/yiding_he/article/details/38410151

(Invalidateoptionsmenu of the Android details menu)

Today's problem is disabling the system's return key, disabling the home key should be permission, and disabling the user experience is not enough. So the way we prevent users from suddenly interrupting in the project is to disable the system return key.

The specific wording is as follows:

public boolean onKeyDown (int keycode, keyevent event) {if (keycode = = Keyevent.keycode_back) {return true;} return false;}

The onkeydown method of the replication system can be. You can also disable other keys, either with a switch or if.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.