Displaying pictures in Gallery without showing other Gallery functions - android

I want to display pictures in the Gallery but without giving the user the capability to manipulate/send them or change the settings of the Gallery application.
Currently I am using the following code:
Intent intent = new Intent(Intent.ACTION_VIEW,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivity(intent);
When I am using ACTION_PICK, the Gallery is opened in "clean" mode without all those functions (manipulate image, send image, change settings, etc) and this is what I am looking for but with ACTION_VIEW intent.

There are hundreds, if not thousands, of "gallery" apps, both pre-installed on Android devices and downloaded from places like the Play Store.
There are no options on ACTION_VIEW to allow you to request "manipulate/send them or change the settings". And there is no requirement that every gallery application honor such a request, even if there were a way to express it.
ACTION_VIEW, and similar implicit Intents, are for linking to third-party apps, where those third-party apps can do what they want. In that respect, it is like linking to a Web site -- you cannot control, from your site, what another site shows the user.
If you need absolute control over the UX here, write your own image viewer.

Related

Changing file paths using third party apps

I am writing an mobile app using Flutter. I want to change some of the default file paths existing in my device.
For example, whenever I click a picture using my phone, it is stored in the default folder.
/storage/emulated/0/DCIM/Camera
I want to change the default file path so when I click a photo, it gets stored in a location of my choice.
Is there anyway I can do that using Flutter?
Is there anyway I can do that using Flutter?
No. There is no way of doing that without Flutter, either.
Where a camera app stores its photos is up to the developers of that camera app. That may be in the location that you specified. It may be somewhere else on the device. It may be not on the device at all, but instead sent directly to a server. Regardless, other apps do not get to control that behavior for when the user uses the camera app directly.
If your app is asking a camera app to take a picture using an ACTION_IMAGE_CAPTURE Intent, you can request that the camera app store the resulting photo in a particular location, using EXTRA_OUTPUT.

Different way to open a PDF than from current SD?

I know there are many similar questions, but I need specifics. I originally wanted my app to open PDFS within the app itself, but I have settled to send an intent activity to adobe reader. I am currently opening PDFS by looking for the file on the device itself. Is there a way I can have the PDFS in my app, and create a folder on the users device, and then look for them? or something similar? Obvisouly the user isn't going to have the PDF already installed on their device. Here is my current code.
Intent intent7 = new Intent();
intent7.setPackage("com.adobe.reader");
intent7.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Download/Auto-example.pdf")), "application/pdf");
startActivity(intent7);
Is there a way I can have the PDFS in my app, and create a folder on the users device, and then look for them?
You can put the PDF in internal storage (e.g., getFilesDir()), then use FileProvider to serve them via a ContentProvider. This sample project demonstrates serving a PDF from internal storage (copied there from assets/) and viewing it in the user's chosen PDF viewer. There is also an Android training module covering this.
With respect to the code that you have, please use ACTION_VIEW as your Intent action (e.g., pass that to the constructor) and delete the setPackage() line.

Select multiple images from device's gallery in Hybrid application

I am developing an application for Android I want the button in the .html file to show the device's native gallery (in my case is android) which user can select multiple images and present it's thumbnails in the html page.
I already watch the video in This Website and I still get confusing.
Thank you for all suggestion and solutions.
Ps. I found the solution of select multiple images Here but I am not sure how to use it. ;(
Unfortunately, this is not possible with the current Gallery application of Android.
Within the Gallery application, you can select multiple photos and you can share them using SEND_MULTIPLE Intent. But that is different.
When you select photo from your application, that is called PICKER. And PICKER Intent does not support multiple selection.

Android PDF viewer app to be invoked

I need a pointer to a (preferably free) PDF viewer app that I can invoke on a file or URL link via a startActivity on an Intent. I know that there is no real standard - I have one phone that came with OpenOffice that can read local PDF files, and one phone that has no built-in PDF reader.
What I want is the name of an application that I can suggest to my users to download from the market that is a PDF viewer that I can invoke by configuring an Intent and calling startActivity. I would make this suggestion when I intercept a URL to a pdf file, and discover that the application is not yet installed. Although ugly, this is better than the blank screen they get now because the built in browser doesn't do PDF.
I already installed Adobe's PDF viewer but it is not showing up in the package manager as being a candidate to handle PDF files.
I have used the technique suggested in SO:how-to-render-pdf-in-android to examine the candidate activities for a URL based PDF link and a local file PDF link and see that the com.android.browser.Browser is always invoked for http:// URL links; a URL of "file.pdf" causes OpenOffice to be selected on one phone and nothing on the other phone. Adobe's PDF viewer is not a candidate for either approach.
I tried the Google Docs viewer approach (as suggested in SO:android-load-pdf-pdf-viewer but that leaves a lot to be desired, especially as the PDF image I tried to load kept moving further and further down the device's screen until a user would need to scroll several screen fulls of blank screen to get to the document.
I see libraries such as android-pdf-viewer as a potential solution. But I'd prefer to link to another application rather than build in PDF support (including the fonts, etc) into my application. This then allows my application to support multiple PDF viewer applications - choosing one that the user has already installed or suggesting my favorite one if no compatible reader is present when I need it. Potentially I could see using these types of libraries to create such an application and load it to the market place, but before doing that I want to make sure that I'm not re-inventing the wheel.
I found the droid-reader application which looks promising, but this doesn't appear to be available from the market place. While I'm personally comfortable with the gymnastics of downloading files to my sdcard and installing from there, its not a viable option for the general public user that I'm targeting.
I hope the following code snippit would be helpful to you for reading pdfs. It will use the default pdf viewer that has been set on your device.
Intent intent= new Intent(Intent.ACTION_VIEW);
File f = new File("/mnt/sdcard/file.pdf");
intent.setDataAndType(Uri.fromFile(f),"application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);

does android provide facility to read ebook in app with some controls?

Does android provide any built it control like video view or image view to display pdf ebook?
More specifically I want to open a pdf ebook in android with following controls on the screen.
zooming controls
turn over functionality/swipe to change page.
What is the suitable way to achieve this?
Android does not provide a default PDF reader. I believe some phones come with a pre-installed application for reading PDFs, but you cannot rely on this fact for all devices. The best you can do for now is choose to open the user's default PDF reader (if they have one installed).
Use an intent to open up the user's default PDF app (untested, should be something like this):
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(pathToPDF, "application/pdf");
startActivity(intent)

Categories

Resources