How do I access the Calendar and Events on Android using Delphi XE5.
问问题
4850 次
2 回答
5
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;
于 2013-10-04T16:41:16.440 回答
0
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;
于 2013-12-22T22:48:38.883 回答