What is the right way to change the display name in an Android FileProvider?
Is using a matrix cursor based on the cursor from super a good plan?
You could do that, and it's probably OK. After all, FileProvider
itself uses a MatrixCursor
.
To modify an existing Cursor
, I use CursorWrapper
myself, in my LegacyCompatCursorWrapper
, then in query()
wrap the Cursor
I get from the base ContentProvider
implementation (e.g., FileProvider
) in my wrapper.
It seems like DISPLAY_NAME and SIZE re the only columns but doesn't seem to confirm if SIZE is int or string.
That's one of the reasons I went with the CursorWrapper
, to avoid messing with any existing values.
That being said, the existing FileProvider
implementation uses a Long
(file.length()
, auto-boxed).