I need to implement an Android application which allows users to browse a large number of images (10000) stored on a server.
I can use REST style HTTP calls to get the information about images e.g. GET http://uri...?itemsstart=n&itemscount=m which returns me the names and locations of images.
I have a content provider with a cursor adapter which I can use to get this information. I’d like to hook this up to a GridView to allow for scrolling of images.
There are several examples here and elsewhere on the web about using similar scenario for a small fixed number of images : you just use setAdapter on the GridView or ListView and it will do its magic when user initiates a database query via menu etc.
In my case, user should be able to scroll through images continuously while the app is loading them in “chunks” in the background.
My question is how and when to initiate a new query to get a new “chunk” of images in such a way that my CursorAdapter/GridView combination will be updated for continuous scrolling?
I would appreciate some advice about this scenario.
Related
I'm using the Soundcloud API from their site, I'm getting the urls to the API from the Network Monitor.
I want to get all the tracks from a playlist, but I only get the track info the first 4~5 ones, the other ones only retrieves an id an other attributes that don't need.
This one is the info I want, this track for example is right.
But this one on the other hand, doesn't have the same data as the previous one.
My theory is that it only loads the data of the first elements because the others are loaded dynamically later, that is, in the browser, it loads the elements that are on the screen, and if you lower the list of tracks, these information will be loaded.
Is there any method to retrieve all the data in one request?
I am creating a voting application, and I want users to be able to create polls.
For each poll, there will be an associated image. I was planning on using either Flickr or Google Images to allow users to search for images to utilize in any polls that they create.
I found the site below from Google's documentation, but it looks like it is deprecated:
https://developers.google.com/image-search/v1/jsondevguide?csw=1#sending-a-basic-query
At the end of the day, I would like for the users to be able to query Google Images from an entered string, and then have the results from Google Images display in a GridView. Any advice on how I would write the request and display the JSON results in a GridView would be much appreciated.
I have a SearchView in ActionBar and I'm using onQueryTextListener with it. I have a Listview in activity's layout to which the ActionBar belongs. There are two Textviews in ListView. So, as user enter text into searchview, a web query(api) is performed on the text and the results(array) received are used to populate the listview. Just like AutoCompleteTextView but instead displaying results in listview.
I am using a HandlerThread to perform this query and populating the listview and I have implemented it in onQueryTextChange which is working.
But, the problem is that it takes long time to display results. The results are displayed after user is done entering input. However, I want results to be displayed as user enter text(Like Google suggest). How can I do this?
I imagine Google uses cached results on their servers to speed up the response to queries. You could use something like MemCache or Varnish to provide results faster. If the results require searches you could also improve the speed by using a search engine like Apache Solr or Lucene.
Google will also have very good server infrastructure with cached results being located all over the world so always near the user. The results will probably vary from server to server so that they give what local users want. I remember calculating a few years back based on trying to improve response times for online gaming that Europe is something like a tenth of a second from North America.
You can also fake this information. You can download results that you anticipate a user would want on to their device and fill the autocomplete from a database on the device. A request can also be sent to the server at the same time and the autocomplete results updated once the response is received from the server. This to some extent depends on the complexity of what you are searching. If there are only a limited number of results you could easily store them all on the device.
I can't seem to find exactly what I'm looking for after a few day's worth of hunting, so if anyone has seen exactly what I'm trying to do elsewhere, I'd love a link or two.
Anyway, I'm trying to build an app to connect into an ERP system that returns user access information in JSON format via REST request using an e-mail address and password. Most users of the system only have a singular access role, so no big deal for them, but others have multiple roles. The trouble I'm having is taking these multiple access roles and adding them into a ListView where they can select the role with which they wish to use to gain access.
Trouble is, I need a display that uses two lines per selection (to properly display all user-pertinent data) and some way to record the user selection. The data useful in the background for the selection would not be displayed, as it would not mean anything to the user. I've been able to take the JSON response and map it to a custom class I designed for it without any problems (not actually all that useful, mostly only helps for discerning the results count prior to displaying multiple results to the ListView). But I can't figure out how to properly build the ListView layout and map the data to the layout. I'm having trouble understanding how to build the view and insert data into new list items.
The best I figure, if I can get the results to display in a ListView and then record the selection in the shared preferences, I'll be golden.
If the listview items being populated from some JSONArray then you could use listview.setOnItemClickListener to get the position of the selected item and match it from the array.Your question seems a little vague. Can you post some code of what you've tried so that it becomes a little clearer?
I'm an Android newbie, learning the SDK by creating some basic apps. I'm currently working on an app that will display content from a news aggregator with news items and comments on each item. Each news item has an 'id', and many comments associated with it.
Each results page will have a 'before' and 'after' reference id to the news item at the beginning of the page and the end, respectively. So each 'query' will be something like '/?before=$ID' or '/?after=$ID'.
It seems like ContentProviders are the preferred way to store data on android. However, the content of the site changes so much that I question whether or not using a ContentProvider would be wise.
I appreciate any insight.
Well content providers are used by the e-mail app to hold e-mail, gmail to store and sync its mail messages, gtalk and contacts to keep track of the people you know and their chat status, etc.
I am not sure just how dynamic you are thinking, but those are all pretty dynamic.
One way to look at it -- a content provider is just an API to access structured data across processes. If that API serves your purpose, well that's a good sign. The other aspect to them is that usually they are implemented on top of a SQLite database, and that is the easiest way to implement them because there is a lot of framework support for that. So you will most likely be using a SQLite database for your content provider impl. Is a database dynamic enough for you?