[Development] Create native FileDialog for Android

Mathias Hasselmann mathias at taschenorakel.de
Fri Aug 10 22:09:24 CEST 2018


Heya,

The general approach to this kind of tasks is to:

- add your own Android activity that extends
   org.qtproject.qt5.android.bindings.QtActivity

- have that activity provide a public method doing all the native
   Android calls

- and to finally invoke this method from C++ via
   QtAndroid::androidActivity().callMethod()

Hopefully this helps you,
Mathias

Am 10.08.2018 um 11:45 schrieb Denis Shienkov:
> Hi guys,
> 
> Is it possible to add an own code to use the Android's native file 
> picker dialog?
> 
> For example, I want (I think) to use a following framework (it 
> introduced to Android since v4.4):
> https://developer.android.com/guide/topics/providers/document-provider
> 
> But a problem is that an Android's platform plugin from the:
> 
> qtbase\src\plugins\platforms\android\qandroidplatformtheme.cpp
> 
> ignores a file dialogs at all:
> 
> {code}
> QPlatformDialogHelper 
> *QAndroidPlatformTheme::createPlatformDialogHelper(QPlatformTheme::DialogType 
> type) const
> {
>      switch (type) {
>      case MessageDialog:
>          return new 
> QtAndroidDialogHelpers::QAndroidPlatformMessageDialogHelper;
>      default:
>          return 0;
>      }
> }
> {code}
> 
> So, is it possible to override this behavior somehow? Or e.g. to create 
> an own
> QAndroidPlatformTheme ? It it possible in Qt at all?
> 
> PS: What is reason that the Android's theme does not support the Color 
> && File Dialogs?
> 
> BR,
> Denis
> 
> 
> 
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
> 



More information about the Development mailing list