-
-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call arbitrary Android intents and get result back #1217
Conversation
* error handling for ActivityNotFoundException still missing... * added example android_intent as a demonstration
… handle the Intent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mechanics of Intent handling look solid; I've got a couple of cosmetic changes that I'll make directly (mostly around the way intent invocation is spelled in the API).
I'm also going to remove the android_intent demo; while I appreciate you adding it (and I imagine it helped with development), the examples folder shouldn't have "platform specific" demos.
async def do_stuff(self, widget, **kwargs): | ||
if self.Intent is None: | ||
from rubicon.java import JavaClass | ||
self.Intent = JavaClass("android/content/Intent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being defined here, rather than using the toga_android.libs version?
This PR allows us to invoke arbitrary Android intents and get back their result.
For this, the async method
invoke_intent_for_result
in toga_android\app.py can be called.An example app is included that uses this method to invoke an intent from the OI Filemanager to select a file.
When no appropriate Activity is found which can handle the intent, a (Python) Exception is raised which is catched in the example app.
PR Checklist: