Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Development

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums on April 1st. BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Posts: 91
Registered: ‎04-05-2013
My Device: Simulator - developer
My Carrier: No provider

System not returning files from the Documents directory

If an Android app requests a file from the system, and starts an external file picker application using an intent, the files are returned properly only if the user does not chose a file in the Documents directory. If the file is chosen in the Documents directory, control is returned to the application with an error code, and nothing is returned. If a user chooses a file in places other than the Documents directory, the control returns to the application with RESULT_OK and the file path or URI is returned, as expected.


We tested this on Z30 and Q10 devices, both running 10.2.1. The bug is definitely in system, rather than application, since errors from system are visible in LogCat before control is returned to the application.


Here is the exception stack that is displayed when the user picks a file in Documents:


04-10 13:56:44.180: E/DatabaseUtils(9314306): Writing exception to parcel
04-10 13:56:44.180: E/DatabaseUtils(9314306): java.lang.IllegalArgumentException: the bind value at index 1 is null
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:164)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.database.sqlite.SQLiteProgram.bindAllArgsAsStrings(SQLiteProgram.java:200)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:400)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:333)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at com.qnx.providers.media.MediaProvider.query(MediaProvider.java:2532)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.content.ContentProvider.query(ContentProvider.java:652)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.content.ContentProvider$Transport.query(ContentProvider.java:189)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:113)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at android.os.Binder.execTransact(Binder.java:351)
04-10 13:56:44.180: E/DatabaseUtils(9314306): at dalvik.system.NativeStart.run(Native Method)


If anybody wishes to take a look at this problem, i can show you the code involved.

Posts: 91
Registered: ‎04-05-2013
My Device: Simulator - developer
My Carrier: No provider

Re: System not returning files from the Documents directory

I extracted the relevant code and created a bug demonstrator app. Please find the code in the attached zip file. Build and run on any BlackBerry 10.2.1 device.


Reproduction steps:

1. Start the app

2. Press the button (file manager starts)

3. Pick a file from the Documents directory

4. See the result when control comes back to the application (it displays error code on error and file URI on success)


If you pick a file from the Downloads or Pictures directory, the bug does not manifest itself.


I would be very happy, if somebody could comment on this issue, our release is close and this is a showstopper for us.

Posts: 91
Registered: ‎04-05-2013
My Device: Simulator - developer
My Carrier: No provider

Re: System not returning files from the Documents directory

Looking for a workaround, we were thinking about using our own file picker dialog. However, the obvious problem with this is - where to look for user's files? We can start a file picker at the location / , but this just shows the guts of QNX and I wasn't able to locate the user's files on the filesystem - i suspect that the user's files are really in a DB of some kind or something like that.


If anybody knows, where the user's files are located relative to the system root, I would be glad to hear about it.

Posts: 91
Registered: ‎04-05-2013
My Device: Simulator - developer
My Carrier: No provider

Re: System not returning files from the Documents directory

I tested all the first level directories, the file manager returned:


error: documents, misc, print, protected_media, voice

URI: camera, downloads, music, photos, videos


Whereas inside the misc and protected_medis directories there are sub-directories, from which the picker returns an URI.


I also tested a custom file picker library, and I discovered, that one can direct it to / and reveal the guts of QNX. I was, however, unable to locate the user's files, they were supposed to be at /accounts/1000/, but nothing is there, if one accesses the location through the QNX filesystem.


I figure you would want to do something about that as well.



Rok Ružič

Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B
My Carrier: Bell

Re: System not returning files from the Documents directory

Hey rruzic,


Many thanks go out to you from all of us here for the investigative work that you've done.


A bug was filed around this issue, has been addressed, and the fix looks like it's already in for our next major release.


For 10.2.1 users, the only way to get around this is to use a different file browser (ex. Astro File Manager).


Sorry for any inconvenience.



Justin Jasmann | Android Application Development Consultant
Developer Relations
Posts: 35
Registered: ‎12-18-2012
My Device: PlayBook
My Carrier: .

Re: System not returning files from the Documents directory

I encountered and reported the issue back in January.

Now, it took BlackBerry 4.5 months only to admit its existence.

Wow, that's not inspiring...

New Developer
Posts: 3
Registered: ‎10-13-2014
My Device: Z10
My Carrier: Vodafone

Re: System not returning files from the Documents directory

Any updates on this issue?