Android Virtual keyboard disable with Enable

Source: Internet
Author: User

  • The code is as follows
    /** * Androidusbcamera-master * Created by LZW on 2018/6/20. 10:53:22 * Email: [email protected] * All rights saved!    Chongqing Anyun Tech Co. LTD */public class Shieldutil {public static final String Status_bar_service = "StatusBar";    public static final String Class_status_bar_manager = "Android.app.StatusBarManager";    public static final String method_disable = "DISABLE";    public static final String method_enable = "ENABLE"; public static void Hidekeys (context context) {try {@SuppressLint ("wrongconstant") Object service = Cont            Ext.getsystemservice (Status_bar_service);            class<?> Statusbarmanager = Class.forName (Class_status_bar_manager); Method disable = Statusbarmanager.getmethod (method_disable, int.class);//Disable.invoke (Servi CE, 0x00200000); Value for View.status_bar_disable_home//Disable.invoke (service, 0x00400000); is the value of View.status_bar_disable_back disable.invoke (service,  0x00200000|0x01000000);        The value of View.status_bar_disable_recent} catch (Exception e) {e.printstacktrace (); }} public static void Showkeys (context context) {try {@SuppressLint ("wrongconstant") Object serv            Ice = Context.getsystemservice (Status_bar_service);            class<?> Statusbarmanager = Class.forName (Class_status_bar_manager);            Method disable = Statusbarmanager.getmethod (method_disable, Int.class); Disable.invoke (service, 0x00000000|0x00000000);        The value of View.status_bar_disable_recent} catch (Exception e) {e.printstacktrace (); }    }}

      

  • Note: can only be used under System permissions , that is, in Androidmanifest.xml
    <?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/ Android "    android:shareduserid=" Android.uid.system "    package=" Com.jiangdg.usbcamera ">

      

  • Need to have permission
    <uses-permission android:name= "Android.permission.EXPAND_STATUS_BAR"/>

      

  • So it's decided that you can only have your own source code, not a custom Android device, that works.

Android Virtual keyboard disable with Enable

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.