function GetTime(aDateTime:TDateTime) : string;
var
aHour, aMinute, aSecond, aMSecond : WORD;
begin
DecodeTime(aDateTime, aHour, aMinute, aSecond, aMSecond);
Result:= InttoStr(aSecond) + '.' + InttoStr(aMsecond);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
i := 0;
end;
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
begin
//처음
if i = 0 then
if Key = vkHardwareBack then begin
Key := 0;
FstartTime:= Now; // 시간 저장(Fstart)
Android.JNI.Toast.Toast('''뒤로''버튼을 한번 더 누르시면 종료됩니다.');
i := 1;
end;
// 두번째
if i = 1 then
if Key = vkHardwareBack then begin
Key := 0;
FEndTime := Now; // 시간 저장(FEnd)
aStartTime:= Gettime(FStartTime);
aEndTime:= Gettime(FEndTime);
aDurTime:=Gettime(FstartTime-FEndTime); // Fstart-FEnd = aDur
if aDurTime < '2' then
SharedActivity.finish;
if aDurTime >= '2' then
FstartTime:= Now; // 시간 저장(Fstart)
Android.JNI.Toast.Toast('''뒤로''버튼을 한번 더 누르시면 종료됩니다.');
i := 1; // i를 1로 변환
end;
end;