How to use file picker in android app - java

I am developing a simple android app, I want to use file picker when I press button, so how can I implement file picker in my app.

I spent some time earlier figuring this out so to wrap up
Intents provide the ability to hook into third-party app components
for content selection. This works well for media files, but if you
want users to be able to select any file, they must have an existing
"file explorer" app installed. Because many Android devices don't have
stock File Explorers, the developer must often instruct the user to
install one, or build one, themselves. aFileChooser solves this issue.
You can clone it from iPaulPro/aFileChooser.

Related

How to share file between apps without file section interface

I am trying to make an app that can easily keep sending files to different apps(whichever the user is running currently), when those apps make request to my app for files.
I was going through this link Sharing a file in Android , Sharing simple data in android and also Sharecompat Blog.
In these links they use a chooser interface to select target apps which I don't want.
My goal is that those other apps can communicate with my app without any clicks or selection.
And In response I can provide them the necessary files.
But I couldn't find anything which can help me build my desired app.
How Can I do it?
Please, Any suggesstions.

How to implement a preference activity for download location in android

I have developed an app which downloads some files from server. I'm using android download manager to download files to mobile device. I want to build a settings screen asking default location to store files using preference activity. How can i implement it.
I want to show all the storage options available in mobile in preference activity. Currently i'm using below line to store the files using download manage.
Here is the code:
request.setDestinationInExternalFilesDir(context, Environment.DIRECTORY_DOWNLOADS + DownloadEntries.getFile_dest_path(), filepaths.get(i));
Please help. I'm new to android.
What you need is something called PreferenceFragment
Preference fragment is just an easy way of creating a settings screen in Android.
You can refer here for the Preference Fragments.
Since Preference Fragments doesn't support file pickers by default, you can use this library here for the file picker.
So you can tell the user to pick a folder and you can create your file in there.

Set every phone can use the module of android application one time

My case now is for example select item, when i select that item, the item will become colour and after i uninstall and reinstall back, the item still is that coloured. I want to know is it possible the item selected of android application still can keep with using the method android_id? I mean this method.
private String android_id = Secure.getString(getContext().getContentResolver(),Secure.ANDROID_ID);
Because I plan to do is every android phone can use the function one time only. Hope can understand my question. I am using android studio.
Yes you can, basically you just need external configuration file that will be saved on external folder outside your application folder. For example you can save your configuration file in sd card. Then on your startup application, always check that file

Allow my Android view to be embedded in other apps

In web-based development and Windows-based development it is possible to develop applets or components that other applications can embed in their own UI seamlessly. I have a component (derived from View) that does some real-time animation that I'd like other apps to be able to embed in their own views or activities. Is it possible to allow other apps to embed this component in them in such a way that, when my app is updated, the other apps will automatically exhibit the updated behavior in their embedded component?
If this is possible, I'm having a hard time figuring out the search terms to use to look up how to do this. How would one app go about embedding a view from another app, and what happens if that other app isn't installed?
You cannot directly allow embeding in the way of an iframe.
However, you could make your View a library project that other developers can include in their app, much like they include another company's SDK. To allow updating automatically, you will need to have your app installed in addition to theirs, and when making the library project, you will have to make a BroadcastReceiver that can react to broadcasts you send from your app to update the Views in other apps.
Your SDK can then receive these Broadcasts, and update your View accordingly.
You can make your current project as Library project. You add the Library project to the project you want use the custom View. Your custom View will be accessible in that project.
You can mark a project as Library project by going to Project Properties > Android and checking the appropriate checkbox.
You can create an app widget for your application, and that widget can be used by any application that acts as a widget host - which few do - but at least you could have it on your home screen. I wonder why this is not done more - that would be a killer feature for many applications.
https://developer.android.com/guide/topics/appwidgets/index.html
Gives more information.

Use blackberry camera in java app to select a photo that was already on file

I know you can use
Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, null);
to get the blackberry camera application to be shown and allow the user to take photos. From which you can use a FileJournalListener to find any created files.
(As shown/implied in this forum post: http://supportforums.blackberry.com/t5/Java-Development/How-to-use-FileJournalListener/td-p/295424)
There are times however, when the user chooses not to take a photo but selects one from the file system. Since this wasn't created at the time I opened it, using the FileJournalListener is not going to meet my needs.
What should I use to get the selected file?
EDIT: The functionality I'm trying to produce I've seen in the Twitter for blackberry application
I think you should create a file picker first,
http://docs.blackberry.com/en/developers/deliverables/11958/Create_a_file_picker_856986_11.jsp
After that in the application, user could select whether to capture new picture or browse from their storage.
If user select the later, open up this file picker and for every images found user can view the image, and the application can save the path where the images located for further processing.

Categories