ACTION_VIEW for images but only a subset of images - android

I have an app that have more than one gallery. It is a travel app and it have a separate gallery for each trip. When I'm taking pictures with the camera I'm saving them in the default MediaStore of the system.
To view an Image I'm using new Intent(Intent.ACTION_VIEW) and it launches the default image viewer. When scrolling with the left and right arrows it displays all the pictures in the folder where the pictures from the camera are saved.
Is there any way to put an extra in the intent when calling VIEW action which images to scroll trough? I have the IDs of the images for a certain trip in a database.
Or putting them in a separate folder is the only solution?

You could also consider building your own preview activity using a GridView. Of course this is more work to do, but also offers more flexibility:
You can create "virtual" folders
You can display images from local store or from the net (if you want to offer synchronization with web albums for example)
You can highlight certain images (favorite, shared)

Related

Android draw shapes on images and save

I have an application that gets image (from gallery or camera) and then I open this image in some Activity. Then I want to draw shapes on this image on tap, these shapes (once drawn) can also be dragged around over the image and removed. After drawing user can save this image with shapes so it can access them later from the application at any time.
I have managed to make image import form gallery or camera to my activity.
My question is I just want a summary of how would this need to be constructed in order to work? How would I save images with shapes and their positions so they are accessible later? I would also have an activity (I guess?) in my app which would show thumbnails of all images edited so far. I have attached some images for reference (first image is image edit screen, second image is showing thumbnails edited for far, each can be accessible for edit again).
I am a beginner so please bear in mind.

How can i display PDF and images in android?

I have to make a fragment that can display different elements (PDF, jpg, jpeg, etc). The user can take the file from the gallery or the internal storage and i know how to do to display a PDF or a Image from gallery but i do not know how can I combine to display all this types.
Thanks!
You need to create your own widget to display these files or use several special widgets and display the content in them in turn.

Android: Hardcode images with paths

I am working on an a simple android application that stores objects in an array, and displays them to the user via a listview. Each object contains a photo and a single text field. For demonstration purposes, I would like to pre-populate this array with some hardcoded objects.
The trouble is that the images are typically acquired through the camera interface, and each object only stores the path to that image. I can add the hardcoded images as drawables, but then they don't have a file path. I could when the app is initialized, convert the drawables to bitmaps and save the bitmaps to the SD card, but that seems too complicated to be the correct answer...
Any ideas on the best way to get these images into file storage so that I refer to them via their URIs?
Thanks!
When you create your views in your adapter, have a ImageView in your layout and use a loader or custom AsyncTask to load the image in the background and have it update the ImageView instance once it has the data.
check the background from this on loading images from the network.
You acquire images from the camera but notice that when you do a resource chooser where mimetype = img/*, the selector just merges local camera(gallery) storage with other photo, content providers. An example of common chooser for photos is in 'Evernote' where you go to the composer view with the 2X2 grid and touch the 'attachment' icon... thats a photo chooser...
In other words , it helps to understand the general practice for managing photos and for presenting them in imageViews.
Typically, there is a lazyLoader that has an interface with args for the imgView and the URI of the image source. Under the covers on a call to 'loadImage(view, uri), the implementation checks the following:
is the bitmap already in a memCache?
the local file , that backs the bitmap, does it exist in the folder reserved for this purpose?
if none of above, go get the array of bytes for the img from across the network ( or in your case , get bytes from camera ).
Even though your question is a little different , IMO , the standard practices for images may apply and you may want to adapt one of the many libs for image presentation to your specific requirements.

android open file in gallery without MediaScannerConnection

Hello i am using this code ( https://stackoverflow.com/a/6772455/579646 ) to open an image in Gallery, but on android 2.2 and 2.3 it shows a me Toast saying "searching for new images and albums ..." and then after about 10 seconds of blank screen it finally shows my image. Plus if i change the image but leave the same file name, the gallery cache kicks in(or something like that) and i see the old image when zoomed out and new picture when zoomed it. The only fix is to use random name every time.
If i use this link https://stackoverflow.com/a/5814533/579646 then it opens faster but then i invade the gallery and it adds a folder to it. Is there a way to remove the folder after the user closes the gallery ?
How can i make Gallery open just one Image without scanning stuff and without adding some folder to the gallery by mediascanner ?
Thanks
Your best option is to create your own Activity for displaying an image within your app (answers to this question should help). You then have complete control over the actions it does. Create a simple activity that takes a path to the image and simply opens that path and displays the image in a full-screen ImageView.
I say this because there's not much you can do about Gallery updating its cache whenever it opens - once you move to a different activity, your app has no influence. And ACTION_VIEW is the correct Intent to be opening an image, but remember that users may not have the standard gallery as the default activityfor it. If they have a different default, the experience might not be so bad.

adding flickr pictures to android gallery and display it

I am new to android, I have learned how to display drawable pic in gallery,
and display a url pic use ImageView. Now I dont know how to display online pictures in gallery. Should I use listview or not? In addtion, I want to know how to get pictures urls from flickrs with given userid
Do you mean like a photo gallery? is that what your app is supposed to do? Then, yes you could use a ListActivity/ListView. However i do not know if this will provide you with exactly the effect you want. A list view would load ALL of the pictures before the UI could be displayed and you would view them by scrolling. typically a photo viewer shows pictures full screen and switches with either a button or a swipe (gesture).
To get the latter effect, your app could display an ImageView with the first pic while it loads the next pic, and then switch to a new ImageView when the user clicks a button or swipes. this will prevent your app from eating up resources and will give you an interface that people are more used to.
as for flickr, you will have to ask someone else (you should separate these into two separate questions because they are so different)

Categories

Resources