So funktioniert's prima, und ganz ohne with:
Delphi-Quellcode:
class function TFileBrowser.Instance: TFileBrowser;
begin
if not assigned(FInstance) then
FInstance := TFileBrowser.Create;
Result := FInstance;
end;
class constructor TFileBrowser.Create;
begin
//Ist doch eigentlich unnötig, oder?
FInstance := nil;
end;
class destructor TFileBrowser.Destroy;
begin
fInstance.free;
end;
class procedure TFileBrowser.BrowseForFile(Content: TContentEnum;
OnExecute: TFileBrowseEvent);
begin
Instance.Initialize(Content, OnExecute);
end;
procedure TFileBrowser.Initialize(Content: TContentEnum;
OnExecute: TFileBrowseEvent);
var
Intent: JIntent;
begin
fOnExecute := OnExecute;
fMessageSubscriptionID := TMessageManager.DefaultManager.SubscribeToMessage
(TMessageResultNotification, HandleActivityMessage);
Intent := TJIntent.Create;
Intent.setType(StringToJString(ContentStrings[Content]));
Intent.setAction(TJIntent.JavaClass.ACTION_GET_CONTENT);
MainActivity.startActivityForResult(Intent, 0);
end;
Danke nochmal.