Android open gallery with local (from 'res' folder) images - android

Is it possible to open Android Gallery for image selection (like ACTION_PICK intent for images from camera and other apps) but make it to show ONLY images stored locally in our app ('res' folder)?
The use case for this is to provide option to select app background from provided images.

No, it is not possible. App assets are not available to standard Gallery application

The standard "gallery" <intent-filter> does not include support for app resources at all.
The use case for this is to provide option to select app background from provided images.
Use your own ViewPager, or GridView, or StaggeredGridView, or AndroidStaggeredGrid, or whatever.

Closest I can think of is using a custom content provider, and maybe using ACTION_PICK with a uri that your content provider responds too?
This is more of a guess than an answer.

Related

Can I use my phonegap app as an image chooser on android?

I have a phonegap app in which you can really easily sort your images and videos, however, I want to be able to let a user choose an image from my app, just as he would choose an image in the gallery.
For example, if he wanted to share an image via WhatsApp or Facebook, you have a button which allows you to add an image. On Android, you will then be able to choose between 'Gallery' and 'Images' (similar app from Google I suppose). After that, you will be taken to the one you've chosen, and then you can pick an image.
Now I want my app to function as the gallery, or at least be an option in this list. Is this possible?
You need to use cordova plugins for this purpose. There are options available:
Camera Plugin: Behaves like the Gallery, but may have memory problems on old devices.
Image Picker Plugin: A simple one to pick an image.
Both of them are also available by using ngCordova (a wrapper around common plugins)

Android display files from URL GET

I'm working on the Android version of an app I did for iOS. I have some files (could be PDF, DOC, PNG, etc) in cloud storage and I retrieve them using an ASPX handler (like http://www.myserver.com/GetFile?name=test.png).
The goal is to DISPLAY ONLY, not download the files.
In iOS I used a UIWebView and it would download and preview the file as long as the OS could handle that file type.
What is the best approach for Android? I've tried the following:
WebView and embedding in google docs (http://docs.google.com/gview?embedded=true&url=) - DOES NOT WORK FOR PNG
Launching a new Activity using myIntent.setDataAndType(myFileURI, myFileMIME); where myFileMIME = MimeTypeMap.getSingleton().getMimeTypeFromExtension(myFileTypeExtension). For PNGS I get "No activity for type image/png"
I think you can try DownloadManager for this.
The second option is a better way for Android, after fetching the file from cloud.
Use MimeType as "image/*", which usually works for all images and opens in default gallery.
So what I've ended up doing is classifying the MIME type as shown above. If the type is "image/*" then I display the image directly in a WebView.
If the type is "application/*" then I embed it in google docs using the 1st method, and display it in the WebView.
Still looking for a better solution.

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.

How to avoid saving picture at gallery or delete it automatically in Android?

The device is Samsung Galaxy III. I developed an APP to run the camera activity and capture an image. After analyzing the image, I print out some text information. Right now every captured image is saved at gallery. I don't need the image to be saved in gallery or SD card. I think either of the following two solutions will work for me, but I don't know how to program it:
avoid saving pictures to gallery.
delete the picture somewhere in the APP.
Any comments are appreciated.
Read Android Camera tutorial.
...
Storage - Are the images or videos your application generates intended to be only visible to your application or shared so that other applications such as Gallery or other media and social apps can use them? Do you want the pictures and videos to be available even if your application is uninstalled? Check out the Saving Media Files section to see how to implement these options.
or see this one: How to save image captured with camera in specific folder.
In the Camera intent when starting, add this:
intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(getTempFile(context)));
I solved my problem with following two steps:
as '#auselen' pointed, save all the images to a specific folder. How to save image captured with camera in specific folder.
delete all the images in that folder somewhere in the APP. How to Delete Image From SDCard in Android
use this for delete a pic
ImgPhoto1.setImageBitmap(null);

Gallery of pictures from distant site - Android

I need to add gallery to my android app. I used gallery in standard way, when pictures are in my folder, but now I need to show pictures when I have just pictures URLs(pictures are on some distant server). How can I achieve that ?
Is the server yours?
You might need to make an API to get the images from the server served to you.

Categories

Resources