Skip to content

Instantly share code, notes, and snippets.

@freeonterminate
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freeonterminate/809a1cabe610e2768fa7 to your computer and use it in GitHub Desktop.
Save freeonterminate/809a1cabe610e2768fa7 to your computer and use it in GitHub Desktop.
バックグラウンドプロセス化したアプリが Front に戻ってきたとき真っ黒問題に対処するコード
//
// あんまり、おこらないかもしれない!
//
// IFMXApplicationEventService をTPlatformServices.Current.GetPlatformService から取り出して
// AppEventService.SetApplicationEventHandler(AppEvent); をして
// そのイベントハンドラで以下の様にする
function TLifecycleManager.AppEvent(
iAppEvent: TApplicationEvent;
iContext: TObject): Boolean;
begin
Result := False;
case iAppEvent of
TApplicationEvent.WillBecomeForeground: begin
{$IFDEF ANDROID}
// onWindowFocusChanged を呼ぶと TWindowManager.Render が呼ばれて再描画される
TThread.Queue(
TThread.Current,
procedure
begin
PANativeActivity(System.DelphiActivity)^.
callbacks^.
onWindowFocusChanged(System.DelphiActivity, 1);
end
);
{$ENDIF}
CallEvent(FOnWillBecomeForeground);
end;
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment