Klapauzius 0 Posted November 17, 2020 I'm looking for a way to open the Android gallery application from an intent (not the integrated action from Delphi). I can open the filepicker from android and reading the result of the intent, but this is unhandy/too complicated for my users: This works but i don't like it. Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_OPEN_DOCUMENT); Intent.setType(StringToJString('image/*')); Intent.putExtra(TJIntent.JavaClass.EXTRA_LOCAL_ONLY, StringToJString('true')); Intent.putExtra(TJIntent.JavaClass.EXTRA_ALLOW_MULTIPLE, True); For Java I found the following solution, but I do not know how to use this solution in Delphi: Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); in delphi: Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_PICK, ?????????); (Delphi 10.4.1) Any help would be great. Thanks Share this post Link to post
Remy Lebeau 1398 Posted November 17, 2020 I doubt that Delphi has natively imported the MediaStore.Images.Media class, but you should be able to import it manually using Java2OP, then you can access the EXTERNAL_CONTENT_URI field like this, eg: var pickIntent: JIntent; // replace TJMediaStore_Images_Media with whatever name Java2OP imports for it... pickIntent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_PICK, TJMediaStore_Images_Media.JavaClass.EXTERNAL_CONTENT_URI); Share this post Link to post
Dave Nottage 557 Posted November 17, 2020 2 hours ago, Remy Lebeau said: I doubt that Delphi has natively imported the MediaStore.Images.Media class There is already an import for it in the Androidapi.JNI.Provider unit. In Delphi 10.4.1, starting at line 3658 Share this post Link to post
Remy Lebeau 1398 Posted November 18, 2020 6 hours ago, Dave Nottage said: There is already an import for it in the Androidapi.JNI.Provider unit. In Delphi 10.4.1, starting at line 3658 Well, I don't have 10.4.1 installed (or the sources for it), so there you go, just shows how little I know 1 Share this post Link to post
Klapauzius 0 Posted November 18, 2020 Thanks! I found it in Androidapi.JNI.Provider unit: intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_PICK,TJImages_Media.JavaClass.EXTERNAL_CONTENT_URI); Share this post Link to post
tiagoom 0 Posted January 28, 2021 Can you post the complet solution, please? For Delphi 10.3....... Share this post Link to post