How do I access the Calendar and Events on Android using Delphi XE5.
RRUZ
To access the calendar you can use the Calendar
class which is represented by the JCalendar
class in Delphi.
You can find a set of samples here
And this is a Delphi sample
uses
Androidapi.JNI.GraphicsContentViewText,
FMX.Helpers.Android,
Androidapi.JNI.JavaTypes;
procedure TForm1.Button1Click(Sender: TObject);
var
Intent: JIntent;
Calendar: JCalendar;
begin
Calendar := TJCalendar.JavaClass.getInstance;
Intent := TJIntent.Create;
Intent.setType(StringToJString('vnd.android.cursor.item/event'));
intent.putExtra(StringToJString('beginTime'), Calendar.getTimeInMillis());
intent.putExtra(StringToJString('allDay'), true);
intent.putExtra(StringToJString('rrule'), StringToJString('FREQ=YEARLY'));
intent.putExtra(StringToJString('endTime'), Calendar.getTimeInMillis()+3600*1000);
intent.putExtra(StringToJString('title'), StringToJString('Hello from Delphi'));
SharedActivity.startActivity(Intent);
end;
in XE5 they started with PlatformServices and put Pickers Service into it: http://docwiki.embarcadero.com/Libraries/XE5/en/FMX.Pickers.IFMXPickerService
probably this piece of code will be usable for you:
var
PickerService: IFMXPickerService;
begin
if PlatformServices.Current.SupportsPlatformService(
IFMXPickerService, Interface(PickerService))
then
FDateTimePicker := PickerService.CreateDateTimePicker;
... // or
FListPicker := PickerService.CreateListPicker;
来源:https://stackoverflow.com/questions/19179303/firemonkey-android-access-calendar-and-events