Android Instance-Exit program (xe8+2)

Source: Internet
Author: User











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,8 FMX. Controls.presentation, Fmx.stdctrls;9 Ten type OneTForm1 =class(Tform) A Button1:tbutton; - Button2:tbutton; - Button3:tbutton; the Label1:tlabel; - Button4:tbutton; - Button5:tbutton; - Button6:tbutton; + procedureButton1Click (sender:tobject); - procedureButton2click (sender:tobject); + procedureButton3click (sender:tobject); A procedureFormkeyup (Sender:tobject;varKey:word;varKeychar:char; at shift:tshiftstate); - procedureButton4click (sender:tobject); - procedureButton6click (sender:tobject); - procedureButton5click (sender:tobject); - Private - {Private Declarations} in  Public - {Public Declarations} to End; +  - var the Form1:tform1; *  $ ImplementationPanax Notoginseng uses - FMX. Platform.android, the FMX. Helpers.android, + Androidapi.JNI.Net, A Androidapi.JNI.GraphicsContentViewText, the Androidapi.JNI.JavaTypes, + Androidapi.helpers, - System. Ioutils; $  $ {$R *.FMX} - {$R *. NMXHDPIPH.FMX ANDROID} - {$R *. LGXHDPIPH.FMX ANDROID} the {$R *. MACINTOSH.FMX MACOS} - {$R *. XLGXHDPITB.FMX ANDROID}Wuyi {$R *. LGXHDPITB.FMX ANDROID} the {$R *. GGLASS.FMX ANDROID} -  Wu procedureTform1.button1click (sender:tobject); - begin AboutLabel1.Text: ='pressing the back key will bring up a dialog box! '; $ End; -  - procedureTform1.button2click (sender:tobject); - begin AMainactivity.finish;{Exit Program} + End; the  - procedureTform1.button3click (sender:tobject); $ begin the {$IFDEF ANDROID} theApplication.MainForm.DisposeOf;{Exit Program} theHalt0); the {$ENDIF} - End; in  the procedureTform1.button4click (sender:tobject); the var About intent:jintent; the begin theIntent: =TJIntent.JavaClass.init (TJIntent.JavaClass.ACTION_MAIN); the intent.addcategory (TJIntent.JavaClass.CATEGORY_HOME); + intent.setflags (TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); - sharedactivitycontext.startactivity (Intent); the End;Bayi  the procedureTform1.button5click (sender:tobject); the begin - application.terminate; - End; the  the procedureTform1.button6click (sender:tobject); the begin the Close; - End; the //This code error, not available, the reason is unknown.  the procedureTform1.formkeyup (Sender:tobject;varKey:word;varKeychar:char; the shift:tshiftstate);94 begin the ifKey = Vkhardwareback Then//If you press the physical return key the begin theLabel1.Text: ='1';98 ifMessagedlg ('are you sure you want to quit? ', Tmsgdlgtype.mtconfirmation, About[Tmsgdlgbtn.mbok, Tmsgdlgbtn.mbcancel],-1) = Mrok Then -Mainactivity.finish;{Exit Program}101Key: =0;//Yes, or you'll quit if you press No.102 Exit;103 End;104 End; the 106 End.





Android Instance-Exit program (xe8+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: 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.