全球旧事资料 分类
常量名
SENSOR_DELAY_FASTESTSENSOR_DELAY_GAMESENSOR_DELAY_UISENSOR_DELAY_NORMAL
说明
在游戏想特别快的反应速度的时候使用游戏用用户接口用取得倾斜度的时候使用(缺省)0123
实际的值
●主要的方法
fSe
sorMa
ager类的主要方法如表14所示表表14Se
sorMa
ager类的主要方法
方法
publicboolea
registerListe
erSe
sorEve
tListe
erSe
sorEve
tListe
erliste
erSe
sorse
sori
tratepublicvoidu
registerListe
erSe
sorEve
tListe
erliste
erpublicvoidu
registerListe
erSe
sorEve
tListe
eru
registerListe
erSe
sorEve
tListe
erliste
erSe
sorse
sorpublicListgetSe
sorLIsti
ttype
处理内容
登录被指定反应速度的。反应速度的指定,使用前面的(表13)的SENSOR_DELAY系列的常量
解除全部的传感器的的登录
解除在se
sor被指定的的登录
用list形式取得能使用的传感器的接口
133Se
sorMa
ager类的I
sta
ce取得例程
Se
sorMa
ager不能直接生成I
sta
ce。Se
sorMa
ager的I
sta
ce是通过Co
text类定义的getSystemService方法取得的。在图11的图ActivitySe
sorMa
ager的I
sta
ce取得,传感器的名字取得,具体代码如下。
f图11
传感器的信息取得例程
A
droidEggSe
sorActivityjavapackagea
droideggstuse
sorimportjavautilListimportimportimportimportimportimportimportimporta
droidappActivitya
droidhardwareSe
sora
droidhardwareSe
sorEve
ta
droidhardwareSe
sorEve
tListe
era
droidhardwareSe
sorMa
agera
droidosBu
dlea
droidwidgetLi
earLayouta
droidwidgetTextView
publicclassA
droidEggSe
sorActivityexte
dsActivityimpleme
tsSe
sorEve
tListe
erCalledwhe
theactivityisfirstcreated
fSe
sorMa
ageri
sta
ceprivateSe
sorMa
agerse
sorMa
agerOverridepublicvoido
CreateBu
dlesavedI
sta
ceStatesupero
CreatesavedI
sta
ceStategetSe
sorMa
ageri
sta
cese
sorMa
agerSe
sorMa
agerthisgetSystemServiceSENSOR_SERVICEsetCo
te
tViewRlayoutmai
Overrideprotectedvoido
Resumesupero
ResumeListSe
sorse
sorsse
sorMa
agergetSe
sorListSe
sorTYPE_ALLLi
earLayoutlayout
ewLi
earLayoutthislayoutsetOrie
tatio
Li
earLayoutVERTICALTextViewtvforSe
sorsse
sorstv
ewTextViewthistvsetTextsgetNamelayoutaddViewtv
ewLi
earLayoutLayoutParamsLi
earLayoutLayoutParamsFILL_PARENTLi
earLayoutLayoutParamsWRAP_CONTENTsetCo
te
tViewlayoutOverridepublicvoido
AccuracyCha
gedSe
sorse
sori
taccuracyTODOAutoge
eratedmethodstubOverridepublicvoido
Se
sorCha
gedSe
sorEve
teve
tTODOAutoge
eratedmethodstub重要点如下所示
1在o
Create方法中取得Se
sorMa
ager的I
sta
ce
f2在o
Resume方法中取得传感器的名字134a
droidhardwareSe
sorEve
t
Se
sorEve
t类是在传感器事件o
AccuracyCha
gedo
Ser
好听全球资料 返回顶部