I am writing an application where my application should show as option when user shares a file ( any type image or normal text file or pdf or with with no extension)
I know it for file like image by adding image/* as data in manifest file and i can able to handle image as URI.
But I needed it for any file type.
Another example is, I open file browser and select a file (can be any type) then in share option my application should appear to handle.
How can I modify my application for this case
You need to add mimeTypes for all file types you wish to handle.
More information at:
http://developer.android.com/training/sharing/receive.html
Related
I have a gallery which is maintained through app and didn't want to give images a jpg extension since I didn't want images to display in phone gallery so users cannot accidentally delete them. Filenames are something like "gall.22", "gall.381", etc. In fact, there are jpeg files.
When I share one or multiple images, they are shared with their filename which is not ending with .jpg and therefore cannot be opened regularly if shared to email, Viber, etc.
Is there a way to share files with a custom name, not the original one (to add just .jpg at the end of filename) and to avoid copying file to another file with wanted name prior sharing?
I didn't want images to display in phone gallery
I think you can try another way instead of rename extension, you can create the folder to store images and create file .nomedia inside this folder. MediaScaner will ignore this folder when scan and you can share image in normal way.
to avoid copying file to another file with wanted name prior sharing
When you share a file by Uri to another app can handle directly by Uri or copy, it depends on another app handle
i want to display files stored in sdcard on clicking button in my android app. How do i do that?
I search a lot for browsing sdcard for files which i can choose for attachment in my android Tab app.
There is a open source project which gives you a complete file picker and can be invoked using intents
https://github.com/iPaulPro/aFileChooser
See this link. its File Chooser example in that you will get current Directory.
Now you have do that like on touch of list item you have to get that doc path and that will useful to send to server or ant other purpose. Make sure if you delete that file from sd card then it will not work .
How can I run PowerPoint (.ppt) file in Android programmatically.
You need either implement your own Activity, whish is able to read ppt files, or use a thirdparty application to do it. In that case you need to know the particular action to set to the intent in order to launch it. As I know, quick office can read ppt files.
I'm having an Android Ftp Client, I download different types of files (.txt , .pdf , .mp3) from the server. And then I list all the files I downloaded.
So my questions are as follows:
If the file is on the SD card & I listed the files by their names. What I want to do is that by clicking on the name the file is opened.
Meaning if the file name is "test.pdf" & I clicked on it it should be opened in the same way the pdf file is opened in the pdf viewer, Same thing goes for mp3 files for example, by clicking on the file I want it to be played.
Thanks alot for the help in advance
Create an ACTION_VIEW Intent, using Uri.fromFile() for the Uri, and with a MIME type suitable for the type of content (e.g., you might decide to use application/pdf for .pdf files). Then, call startActivity() on that Intent.
There may be an open source Android file manager app that you could examine to see how they approach it.
in my application, user downloads any ebook format file from the web site and i need to handle that downloaded file in my code for the purpose of -Enable the user to view the ebook in a android device.
how to get control of a file after downloaded in to sdcard
how to change its file extension and file content
i found following answers:
we can use file handling Technic to move ,copy etc
to know its MIME type we can use setOnDownloadListner.