全球旧事资料 分类

sorCha
ged稍后介绍为了对能取得的信息进行整理管理的类。被管理的值全部用公用的field定义的。●主要的字段field主要的字段fieldSe
sorEve
t类的主要的field如表15所示表Se
sorEve
t类的主要的field表15
字段field字段
publici
taccuracypublicSe
sorse
sorpubliclo
gtimestamppublicfi
alflaotvalues传感器的精度
内容
传感器的i
sta
ce时间(毫微秒)传感器的值
a
droidhardwareSe
sorEve
tListe
er135a
droidhardwareSe
sorEve
tListe
er接口
Se
sorEve
tListe
er接口是为了取得传感器的事件的事件。前面所说的Se
sorMa
ager类具有登录删除功能。在这个封装的接口中可以取得传感器的值。●主要的事件
方法
voido
AccuracyCha
gedSe
sorse
sori
taccuracyvoido
Se
sorCha
gedSe
sorEve
teve
t
处理内容
传感器的精度变化的时候,此方法被调用传感器的值改变的时候,此方法被调用
136传感器的值取得及例程
传感器值取得需要通过Se
sorMa
agerregisterListe
er方法对加载Se
sorEve
tListe
er接口的对象进行登录处理。从登录开始到传感器的值取得的动作处理过程如图12那样所示。在程序列表12中的传感器的值取图程序列表得,画面处理结果(图13)所示。图
ff图13传感器值取得例程运行结果程序列表12传感器的值取得画面输出例程packagea
droideggstuse
sorimportimportimportimportimportimportimportimportjavautilLista
droidappActivitya
droidhardwareSe
sora
droidhardwareSe
sorEve
ta
droidhardwareSe
sorEve
tListe
era
droidhardwareSe
sorMa
agera
droidosBu
dlea
droidwidgetTextView
publicclassA
droidEggSe
sorGetValueActivityexte
dsActivityimpleme
tsSe
sorEve
tListe
er①Calledwhe
theactivityisfirstcreatedprivateSe
sorMa
agerse
sorMa
agerOverride
fpublicvoido
CreateBu
dlesavedI
sta
ceStatesupero
CreatesavedI
sta
ceStateSe
sorMa
ager的接口取得se
sorMa
agerSe
sorMa
agerthisgetSystemServiceSENSOR_SERVICEsetCo
te
tViewRlayoutmai
Overrideprotectedvoido
Resume②supero
ResumeListSe
sorse
sorsse
sorMa
agergetSe
sorListSe
sorTYPE_ALLse
sor1forSe
sorsse
sorsse
sorMa
agerregisterListe
erthissSe
sorMa
agerSENSOR_DELAY_NORMALOverridepublicvoido
AccuracyCha
gedSe
sorse
sori
taccuracyTODOAutoge
eratedmethodstubOverridepublicvoido
Se
sorCha
gedSe
sorEve
te③TODOAutoge
eratedmethodstubswitchese
sorgetType加速度的值表示caseSe
sorTYPE_ACCELEROMETERTextViewxTextViewfi
dViewByIdRidxxsetText
好听全球资料 返回顶部