Results:
1. If you want to remove the local, millet mobile phone to pay attention to, can not take the network album.
Operation:
1. Two TButton (Button1 and Button2), one tactionlist (ActionList1), one timage (Image1).
2.button1 Stylelookup Choose Cameratoolbutton, Button1 stylelookup choose Organizetoolbutton.
3. Double-click ActionList1, click New Standard Action in the context menu in the Pop-up dialog box, and select Takephotofromlibraryaction ( Select a photo from the picture library and Takephotofromcameraaction (take a photo with your camera), so you have two standard Action.
4. Write the following code in the TakePhotoFromCameraAction1 ondidfinishtaking event:
Image1.Bitmap.Assign (Image);
Similarly, write the following code in the Ondidfinishtaking event of TakePhotoFromLibraryAction1:
Image1.Bitmap.Assign (Image);
5.button1 action set to Takephotofromcameraaction1,button2 is set to TakePhotoFromLibraryAction1.
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.actions,8 FMX. Actnlist, FMX. Objects, FMX. Controls.presentation, Fmx.stdctrls,9 FMX. Medialibrary.actions, FMX. Stdactns;Ten One type ATForm1 =class(Tform) - Button1:tbutton; - Button2:tbutton; the Image1:timage; - actionlist1:tactionlist; -Takephotofromlibraryaction1:ttakephotofromlibraryaction;//manually added action -Takephotofromcameraaction1:ttakephotofromcameraaction;//manually added action + proceduretakephotofromlibraryaction1didfinishtaking (image:tbitmap); - proceduretakephotofromcameraaction1didfinishtaking (image:tbitmap); + Private A {Private Declarations} at Public - {Public Declarations} - End; - - var - Form1:tform1; in - Implementation to + {$R *.FMX} - {$R *. NMXHDPIPH.FMX ANDROID} the * //camera function from mobile phone $ proceduretform1.takephotofromcameraaction1didfinishtaking (image:tbitmap);Panax Notoginseng begin - Image1.Bitmap.Assign (Image); the End; + A //local albums from the phone the proceduretform1.takephotofromlibraryaction1didfinishtaking (image:tbitmap); + begin - Image1.Bitmap.Assign (Image); $ End; $ - End.
Android instance-get photos from camera or gallery (xe8+ Xiaomi 2)