Extending SimpleCursor Adapter - android

I'm new to android development and i was looking for simplest explanation for using the SimpleCursorAdapter class with a cursorloader for pulling out Video Thumbnails and details from my android device. I'm doing a mini video file browser in my app which i am using a gridView, a Fragment, and some content providers pointing to some external URI. Any form of help will be very much appreciated

Take a look at the Android training guides.
The guide Loading Data in the Background shows you how to set up a CursorLoader and use it to get data from a content provider.
The guide Sending Operations to Multiple Threads shows you how to do work on a background thread. It includes sample code for downloading, caching, decoding, and displaying images, which is pretty close to what you're doing.
The second guide makes extensive use of Fragments.
I'm not sure what you mean by a content provider that "points to some external URI". Content providers can be backed by any type of data, but they're best suited to structured data that exists on the device.

For an example of downloading images in the background, take a look at here.
I used this in a ListView and it works nicely to download images on another thread as well as managing a cache of the images. Easy callbacks are used and I implemented a view switcher in my list to allow an easy transition from the placeholder image to the real, downloaded image.

Related

Using Amazon S3 TransferUtility files as image source for Fresco

I have a set of images that are being periodically uploaded to an Amazon S3 bucket. I need to display these images in my app. As opposed to manually writing code to handle aspects like multi-threaded downloads and caching I wanted to use Fresco to do this as I'm already using it for other tasks within my app. This answer mentions that it's possible to do this by writing a custom content provider which wraps a transfer observer. However, the specifics of doing this don't seem to be clear.
A bunch of tutorials about writing a custom content provider available. For instance: https://developer.android.com/guide/topics/providers/content-provider-creating.
Another option might be to implement a custom network fetcher which handles special URIs and queries S3 underneath: https://frescolib.org/docs/using-other-network-layers.html

Dynamic Loading in Listview Android

My DataBase contains 1000's of images on server , I have to display these images in ListView in Android.
I have to develop similar List like that in the Flipcart app(If User Scroll then download Images) and store a local copy in SQlite and display from that SQlite database.
(In future if connectivity would not be there then also I would be able to run my app)
because Images will be available in SQlite.
Please suggest proper Solution for that.
Use of loaderManager or something else please suggest
I don't advise towards storing the images themselves in the SQLite database. The database will become slower to use and more cumbersome. Also, I think you should not implement such complex functionality yourself as there are many ready to use open source solutions.
There are a lot of solutions that allow you to cache the images on the file storage. They work transparently - when you request url they first check the local cache and only if this check does not exist they will make network call. Most of them also will display default thumbnail until the network call succeeds. Basically I think this is the best you can do.
I, myself have used Universal Image loader for what I describe, but out of this thread you can find many alternatives.

Storage of Images in DB as URL or blob for android app

I have large amount of pictures in server and need to show up in android app as list view. I tried storing just Url in db, but while retrieving from server it gives an error because of using more number of async task. Any suggestion with regard to this, As it would be useless if i store so many images and if i dont do that, its affecting user experience.
You should not fire up a separate AsyncTask for each image. I suggest that you use a single AsyncTask to retrieve all images, one (or a few) at a time. As each image is received, the AsyncTask can use publishProgress (you will need to override onProgressUpdate) to display it in the UI.
Are you making use of lazy-loading? Whenever you need to load a large, indeterminate number of images it's commonly advised to use lazy loading to both improve user-experience and to solve memory management issues.
Read/watch the following links:
Lazy load of images in ListView
http://www.youtube.com/watch?v=gbQb1PVjfqM

Android: Best way to Display Images on a screen

This could potentially be a duplicate but I after spending several hours reading about ImageView, ImageSwitcher, Gallery Views, Lazy Loads, and more I decided I should just ask.
I am working on an app and in one of the screens there may be an image or multiple images associate with what I am talking about. The other data for this intent will be pulled from a local database. In the database it will also have a list of URLs of images that are associate with each thing that I am discussing. So I would like to know the best way to display a thumbnail of these pictures (if there are any) on the screen. Then if these pictures are clicked on it can open up the bigger version of these pictures. I don't necessarily want to download these pictures since I don't want to save them locally for the app. Plus I don't want to make the page delay in loading while it waits to download the pictures.
What is the best way to handle this scenario?
I have to caution you, that with newer versions of Android, applications can't make connections to the internet that build the UI directly on the UI thread. Instead, it must be accomplished in a background thread such as ASyncTask. So if you're going to go with making ImageViews without src in your XML, that's fine, but you can't just have the ImageViews go download their images via URL in the onCreate of your main activity any longer. It has to be done in the background, else you'll get an error.
It makes the process fairly more complex, to be honest, but it does improve application responsiveness.
For now, since images aren't the main focus of my app, I decided to just embed a webview in my page and then display the image in some custom html ( I had a list of URLs to the images online). I also calculate the width of the screen and then I adjust how wide the images are going to be in my html.
This was the easiest since the webview takes care of the "threaded" part and I don't have to worry about how to handle/save/and display the images.
It would have been helpful to see a best practices guide when it comes to android and handeling images.

Produce thumbnail from pdf on Android

I am managing a bunch of PDF files in an android application maintaining a list of records in a SQLite database as well as storing the pdf files on the external storage.
Now I would like to present a thumbnail of the first page of the pdf in my list view as part of each cell representing a pdf.
I am aware of libraries like iText, fop.. on the JavaSE side that can render a PDF but I would rather not delve into embedding a large library like that. On a similar approach I would also rather not embed a native PDF viewer like droidreader, apv or vudroid.
Otherwise I could of course also get it rendered on a server via some webservice but that is a lot of headache as well.
I am already using intents to get the pdf's displayed for the user so I was thinking it would be great if I could get a thumbnail via a intent call as a result somehow. However I found nothing on the web (e.g. on openintents) that indicates something like that exists ..
So I am a bit at a loss on what to do? What do you think is the best approach to get these thumbnails into my app? Are there any public intents available? Or did I just totally miss something and the SDK provides features for that already (it should imho but currently does not)?
You are going to get a lot faster resopnse rasterizing the PDFs on the server and there are lots of libraries to do this in C, Java, Php.

Categories

Resources