Hi! Just installed Delphi XE5. :) Grate.
Hi! Just installed Delphi XE5. :) Grate.
1. Can't find the way to call other activity and get data back from it.
2. make my application to be called as activity by others.
Any Ideas? thanks.
1. Can't find the way to call other activity and get data back from it.
2. make my application to be called as activity by others.
Any Ideas? thanks.
"Not pretty" is not problem if it will work :)
ReplyDeleteThanks :)
Well, for now you can do half the job easily enough. That snippet for launching it you should be able to get working by appropriate fiddling with these snippets:
ReplyDeleteprocedure LaunchURL(const URL: string);
var
Intent: JIntent;
begin
Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW,
TJnet_Uri.JavaClass.parse(StringToJString(URL)));
SharedActivity.startActivity(Intent);
end;
procedure ShowBatteryUsage;
var
Intent: JIntent;
ResolveInfo: JResolveInfo;
begin
Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_POWER_USAGE_SUMMARY);
ResolveInfo := SharedActivity.getPackageManager.resolveActivity(Intent, 0);
if ResolveInfo = nil then
ShowMessage('Cannot display battery usage')
else
SharedActivity.startActivity(Intent);
end;
Likely units required will be these: FMX.Helpers.Android,
Androidapi.JNI.JavaTypes,
Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.Net
Alas the onActivityResult side of things will have to wait a bit until I can document what I've done in my current project (which requires custom command-line build script to re-build the Android package).
"Not pretty" is one thing, but it's also a tad involved, thanks to the lack of catering for this (yet).
Well done Brian Long, resolveactivity is a good find!
ReplyDelete