Android Instance-motionsensor acceleration (xe8+ Xiaomi 2)

Source: Internet
Author: User



Instance code:

1 UnitUnit1;2 3 Interface4 5 uses6 system.sysutils, System.types, System.uitypes, system.classes, System.variants,7 FMX. Types, FMX. Controls, FMX. Forms, FMX. Graphics, FMX. Dialogs, System.sensors,8 Fmx.stdctrls, FMX. Controls.presentation, System.Sensors.Components;9 Ten type OneTForm1 =class(Tform) A Motionsensor1:tmotionsensor; - Switch1:tswitch; - Label1:tlabel; the Timer1:ttimer; - Label2:tlabel; - Label3:tlabel; - Label4:tlabel; + Label5:tlabel; - Label6:tlabel; + Label7:tlabel; A Label8:tlabel; at Label9:tlabel; - Label10:tlabel; - Label11:tlabel; - Label12:tlabel; - Label13:tlabel; - Label14:tlabel; in Label15:tlabel; - Label16:tlabel; to Label17:tlabel; +     procedureSwitch1click (sender:tobject); -     procedureTimer1timer (sender:tobject); the     procedureformcreate (sender:tobject); *   Private $     {Private Declarations}Panax Notoginseng    Public -     {Public Declarations} the   End; +  A var the Form1:tform1; +  - Implementation $  $ {$R *.FMX} - {$R *. NMXHDPIPH.FMX ANDROID} -  the proceduretform1.formcreate (sender:tobject); - beginWuyiTimer1.enabled: =False; the End; -  Wu procedureTform1.switch1click (sender:tobject); - begin =switch1.ischecked; $Timer1.enabled: =switch1.ischecked; - End; -  - procedureTform1.timer1timer (sender:tobject); A var +LProp:TCustomMotionSensor.TProperty;//all parameters that may be obtained the begin -    forLpropinchMotionSensor1.Sensor.AvailableProperties Do//start the loop and show if the phone supports this parameter $   begin the      CaseLprop of the TCustomMotionSensor.TProperty.AccelerationX: the       begin theLabel10.visible: =True; -Label10.text: = Format ('acceleration X:%6.2f', [MotionSensor1.Sensor.AccelerationX]); in       End; the TCustomMotionSensor.TProperty.AccelerationY: the       begin AboutLabel11.visible: =True; theLabel11.text: = Format ('acceleration Y:%6.2f', [MotionSensor1.Sensor.AccelerationY]); the       End; the TCustomMotionSensor.TProperty.AccelerationZ: +       begin -Label12.visible: =True; theLabel12.text: = Format ('acceleration Z:%6.2f', [MotionSensor1.Sensor.AccelerationZ]);Bayi       End; the TCustomMotionSensor.TProperty.AngleAccelX: the       begin -Label13.visible: =True; -Label13.text: = Format ('Angle X:%6.2f', [MotionSensor1.Sensor.AngleAccelX]); the       End; the TCustomMotionSensor.TProperty.AngleAccelY: the       begin theLabel14.visible: =True; -Label14.text: = Format ('Angle Y:%6.2f', [MotionSensor1.Sensor.AngleAccelY]); the       End; the TCustomMotionSensor.TProperty.AngleAccelZ: the       begin94Label15.visible: =True; theLabel15.text: = Format ('Angle Z:%6.2f', [MotionSensor1.Sensor.AngleAccelZ]); the       End; the TCustomMotionSensor.TProperty.Motion:98       begin AboutLabel16.visible: =True; -Label16.text: = Format ('Motion:%6.2f', [MotionSensor1.Sensor.Motion]);101       End;102 TCustomMotionSensor.TProperty.Speed:103       begin104Label17.visible: =True; theLabel17.text: = Format ('Speed :%6.2f', [MotionSensor1.Sensor.Speed]);106       End;107     End;108   End;109 End; the 111 End.

Android Instance-motionsensor acceleration (xe8+ Xiaomi 2)

Related Article

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: 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.