Is there a file picker widget for custom file formats? - java

I'm writing a bitmap editor. Each document consists of about 3 bitmap layers and documents are, at the moment, saved as a custom file with a .bme extension. These files can be converted to standard jpg/png files by rendering each bitmap on top of one bitmap and saving the latter.
I need some way for the user to be able to select .bme files they've created already. Is there anything in Android that can make this easier for me?
The only option I can see is to write an activity that creates a list view and write a list adapter that looks for .bme files on disk i.e. a copy of the standard "Media Gallery" app that works for my .bme files. The list adapter will either have to generate a thumbnail preview of the image to show to the user or I'll have to package such a preview in the .bme file when they're created.
This is the only option I can think of. I thought I'd ask in case there is more Android friendly way of doing this. For example, can you add custom file support to the "Media Gallery" app?

Is there anything in Android that can make this easier for me?
Nothing built in. If it weren't for the extension filter, you could link to OI File Manager.
This is the only option I can think of.
It seems like a fine, upstanding option.
For example, can you add custom file support to the "Media Gallery" app?
Not that I am aware of, sorry. Besides, that app is not on all phones.

Related

Is there any function in Android to add PDF files?

I am making an Android app which will contain several PDF files, so that when I share this application with my friends they must be able to download these PDF files. But I am unaware of how to add PDF files in Android applications. Is there any function to do so?
Webview would be the easiest form of PDF viewing. Maybe start from there and work yourself up to something more demanding.

Prevent Google Photos to ask for backing up app folders

I am making a chat app that stores sent images in it's private folder on external storage. After saving an image the Google Photos app notices that and asks if the user wants to backup that folder.
Is there a way to prevent that?
'.nomedia' file does not help.
Kindof, Google backup reads imgs and video types.
There are 3 workarounds that I know,
Make the Folder hidden.
Add "." before the folder name. (when u create the folder)
Have a lot of folder hierarchy.
Example: /0/AppName/sentimgs/ <- Can be read by google backup
/0/AppName/bla/bla/bla/sentimgs/ <- Cant be read.
Save the img without an extension. And make ur app add it when they want to view it.
The Shank's first solution worked for me.
However, I noticed that I created .nomedia file wrong, so after fixing it the backup problem has been also solved.

How to create my own custom file type containing an image or an audio file

I want to find a way to save captured picture and recorded sound in custom file-type(s) then open them in my app. I don't want to other apps could open my files (for example gallery app don't open my pictures).
Is there any way to encode and decode my files in my app for example by writing a string at end of files.
Thanks
There is no need for custom file types. If you save your files in Internal Storage, no other application can access them. You can also save files in the External Storage that are private, by calling getExternalFilesDir().
Details are here: http://developer.android.com/guide/topics/data/data-storage.html#filesInternal
Use a file extension no one else uses, then use this answer to open all such files with your app.

Android application that receives XML files and renders them

I was wondering if it was possible to run an application on Android that will receive XML files during runtime, where these newly received XML files will then be rendered to the screen (will be shown as layout/view/string).
I was thinking that maybe you could add the newly received XML file to your res folder, but I don't think it'll change much since the generated R class will not be updated when the application is already compiled.
I have also thought of implementing my own XML parsing and rendering, but that would pretty much be like rewritting the entire render mechanism of Android.
Need help!
It will then display on screen the XML data using Android rendering (it should render it as if home_layout.xml was in the res folder)
LayoutInflater does not support anything but layout resources. You would need to write your own layout inflation logic from scratch. Given that you create your desired View hierarchy from the XML, the actual rendering would be no different than if the layout had been inflated from a resource.

Xuggler/Java Thumbnail from Video

I'm building an app in Grails, but I am well versed in Java also. I need to display thumbnails of video files, and then when the user clicks on a thumbnail, open that video in a player. (Like Youtube).
What I am thinking is, when the user posts the video, I'll use xuggler to grab a thumbnail, and save that along with the video file itself.
Question 1: Is that a good design?
I am not familiar with xuggler.
Question 2: Is there some way to grab a thumbnail from input stream as the user is uploading? Otherwise, I am going to write the file, and then grab the thumbnail from that as described here.
Xuggler seems like the way to go.
I'm doing something similar at the moment. I'm opting to download the entire file payload before attempting to assume I was given a video.
I've built a similar system in PHP and users submitting Windows Movie Maker project files was a real issue.
application/octet-stream was a very common content-type from machines that didn't know file type associations

Categories