系統設定相關操作

2021-07-09 19:10:43 字數 1982 閱讀 5326

1. 設定禁止螢幕鎖屏

getwindow().setflags(windowmanager.layoutparams.flag_keep_screen_on,

windowmanager.layoutparams.flag_keep_screen_on);

2.軟鍵盤狀態設定

1) 如果有軟鍵盤,那麼隱藏它;反之,把它顯示出來。**方法如下:

//1.得到inputmethodmanager物件

inputmethodmanager imm = (inputmethodmanager) getsystemservice(context.input_method_service);

//2.呼叫togglesoftinput方法,實現切換顯示軟鍵盤的功能。

imm.togglesoftinput(0, inputmethodmanager.hide_not_always);

2) 顯示軟鍵盤

//1.得到inputmethodmanager物件

inputmethodmanager imm = (inputmethodmanager) getsystemservice(context.input_method_service);

//2.呼叫showsoftinput方法顯示軟鍵盤,其中view為聚焦的view元件

imm.showsoftinput(view,inputmethodmanager.show_forced);

3) 隱藏軟鍵盤

//1.得到inputmethodmanager物件

inputmethodmanager imm = (inputmethodmanager) getsystemservice(context.input_method_service);

//2.呼叫hidesoftinputfromwindow方法隱藏軟鍵盤

imm.hidesoftinputfromwindow(view.getwindowtoken(),0);//強制隱藏鍵盤

4) 獲取輸入法開啟的狀態

//1.得到inputmethodmanager物件

inputmethodmanager imm = (inputmethodmanager)getsystemservice(context.input_method_service);

//獲取狀態資訊

booleanisopen=imm.isactive();//isopen若返回true,則表示輸入法開啟

3. **中複製內容

clipboardmanager clipboard = (clipboardmanager) getsystemservice(clipboard_service);

clipboard.settext(「要複製的內容」);

4.呼叫系統相機拍照,獲取(壓縮後的)**

1) 開啟相機

intent intent = new intent(mediastore.action_image_capture);  

startactivityforresult(intent, 1); 

2) 獲取**

protected void onactivityresult(int requestcode, int resultcode, intent data)

file:拍完儲存的**位址-----***x/***x.jpg

作業系統相關

程序 乙個執行的程式就是乙個程序。是系統資源分配的最小單位,擁有自己獨立的記憶體空間。既不共享堆也不共享棧 由作業系統排程 執行緒 排程執行的最小單位,不能獨立存在,共享記憶體。共享堆不共享棧 由作業系統排程 協程 是一種使用者態的輕量級執行緒,排程完全由使用者控制。和執行緒一樣,共享堆不共享棧 由...

作業系統相關

seo search engine optimization 漢譯為搜尋引擎優化。是一種方式 利用搜尋引擎的規則提高 在有關搜尋引擎內的自然排名。目的是讓其在行業內佔據領先地位,獲得品牌收益。很大程度上是 經營者的一種商業行為,將自己或自己公司的排名前移。作業系統 operating system,...

php相關設定,PHP常用系統設定整理

1.設定時間指令碼執行時間 set time limit 0 2.設定最大執行記憶體 ini set memory limit 1024m 設定記憶體 memory get usage 獲取php使用記憶體 3.設定與客戶機斷開是否會終止指令碼的執行,直至有輸出任務為止 ignore user ab...