Delphi android application is raising issue in Lennova A5000 mobile

旧城冷巷雨未停 提交于 2019-11-29 07:56:14

Atlast I got the solution from Embarcadreo website. Please follow the mentioned steps.

1.Copy FMX.Platform.Android.pas to the project folder from source/fmx folder and add the copied files to the project.

  1. Then, do the changes in the following procedures.

procedure TPlatformAndroid.RunOnUIThread(Proc: TThreadProcedure);

procedure TPlatformAndroid.RunOnUIThread(Proc: TThreadProcedure);
begin
  //MainActivity.runOnUiThread(TSimpleProcedureRunner.Create(Proc));
  CallInUIThread(
  procedure()
  begin
    Proc;
  end);
end;

procedure TPlatformAndroid.SynchronizeOnUIThread(Proc: TThreadProcedure);

procedure TPlatformAndroid.SynchronizeOnUIThread(Proc: TThreadProcedure);
var
  Runner: TSimpleProcedureRunner;
begin
//  CallInUIThread(
//  procedure()
//  begin
//  Runner := TSimpleProcedureRunner.Create(Proc);
//  MainActivity.runOnUiThread(Runner);
//  Runner.Event.WaitFor;
//  end);
  CallInUIThreadAndWaitFinishing(
  procedure()
  begin
    Proc;
  end);
end;

procedure TPlatformAndroid.SetClipboard(Value: TValue);

procedure TPlatformAndroid.SetClipboard(Value: TValue);
var
  Setter: TClipboardSetter;
begin
  Setter := TClipboardSetter.Create(Value.ToString);
  CallInUIThread(
  procedure()
  begin
  SharedActivity.runOnUiThread(Setter);
  end);
  Setter.Done.WaitFor(INFINITE);
end;

function TPlatformAndroid.GetClipboard: TValue;

function TPlatformAndroid.GetClipboard: TValue;
var
  Getter: TClipboardGetter;
begin
  Getter := TClipboardGetter.Create;
  CallInUIThread(
  procedure()
  begin
  SharedActivity.runOnUiThread(Getter);
  end);
  Getter.Done.WaitFor(INFINITE);
  Result := Getter.Value;
end;
  1. Then, Rebuild the project. After doing this every thing is working fine.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!