Android's query suggestion - android

Does anyone know what algorithm Google uses in query suggestions for android (the feature of autocomplete that retrieves text from database or an array when you start typing)?
I'm really interested in knowing the used algorithm to achieve that, and I couldn't yet find information about it from anywhere!
Thanks

Related

Android Search in other languages based on pronunciation

I have been struggling with a problem from past few days.
We have to implement a search feature that must be able to search the content that is written in other languages but searched in English pronunciation. For example if there is a content like below
Hello is translated as 你好 in Chinese, Pronounced as Nǐ hǎo, so if the user types Nǐ hǎo in the search field 你好 should be in the search results.
I found that contacts app is doing something similar for which I have uploaded a screenshot here. I thought that we have to go with some Transliteration kind of idea, but it won't work here as the content is dynamic. So I wanted to know what might be a simpler way to achieve this.
I am not sure on where to start with this issue. Can anyone please point me to a link that would help me with this?
Thanks in advance.
The Contacts app isn't doing transliteration in real-time when you search for a word.
It stored the phonetic-name of a contact into the contact details, and searches for the regular display-name as well as the phonetic field.
I think you need something else, that will happen in real-time
There was a feature request for this to be added to Android, but it was rejected.

Google Places API - any way to enumerate the Place Types list?

My question is in the context of an Android app providing users with a way to add Places to the Google Places database. Regarding this page:
https://developers.google.com/places/supported_types
After extensive searching, I've been unable to find a way to retrieve these types from the API in a manner suitable for presentation to the user. Does anyone know a way to accomplish this, or is there a built-in dialog I can call (similar to the Place Picker)?
Thank you in advance.
I see this is old so you've likely worked around your issue by now. For the benefit of others, here's a work around since Google seems to have left us dangling on this one.
First, I've created a small data file having all of Google's constants (as of this posting date) associated with friendly names. The two values are separated by commas.
Here's a link to the file:
https://drive.google.com/open?id=0B_33r2IAzcMibndhT2RicWdLUXc
This file can be formatted in JSON if you wish, or read as is. Use it as a source for an AutoCompleteTextView DataAdapter, so the users can easily select a place type. I haven't written the code yet. My needs are different than yours so my code won't meet your needs, but it should be pretty easy to implement an AutoCompleteTextView with this data.

Querying the time using Google Search Results

This one is puzzling me...
For my Android application I want to be able to return the current time in any location the user requests (right down to city level). The request itself comes from a voice command, so I cannot use alternative methods.
The most obvious way (so I thought) was to query Google, but I need your brains to help me solve how to extract the data I want please!
In Google, query:
"What's the time in China"
You should see a 'widget' at the top displaying the answer nicely. View the page source and search on 'China' and it's there - I thought great, this is going to be easy!
But...
"What's the time in London"
Although the display in Google appears the same, there is no result for 'London' when searching the source HTML...?
Using Google Chrome, I inspect the element of the 'widget' and can then view the contents I wish to extract in all cases.
So, my questions is firstly, am I missing something obvious (Google don't want us to be able to do this for example)? Or is there a way to 'force' the result to be in the HTML by structuring the query perhaps?
Secondly, is there a way to access the specific 'element container' and return the results to my Android Application?
I thank you in advance...
You should really use an API instead of parsing html.
I guess there are many many API which will give you the time in a given city.
http://www.worldweatheronline.com/time-zone-api.aspx for example (havnt tried it myself)
If you still want to extract data from the google result (which is html), check for html parsers like in this post : Parse HTML in Android

How can i show suggestions for multiple values for edittext field in android?

I need a functionality in android app, that is similar to Gmail app in android real device which has drop down suggestions for multiple value in "To" field or like stack overflow's tag suggestions for multiple values. For example, I entered a email address in the To field and then i need to list the email addresses for the entered text after the comma value, i I searched a lot for this functionality but i cant find the exact solution. Please advice and any help will be appreciated.
So the autocomplete for gmail is probably a lot more complex than you'd want. If you're interested in the source and what the actual gmail autocomplete looks like, please look at the source for MessageCompose at line 587 - 605 as well as the GalEmailAddressAdapter (the code that actually does the autocompletion.)
If you are doing auto completion using the user's contacts, it's a lot simpler. Please view that example here.
Edit: I found a much better example for you here: http://www.betaful.com/2011/02/multiple-e-mail-autocomplete-in-android/
Again, looks through contacts for autocomplete but includes code for multiple lookups.

Android Content Provider without SQL

my android application is handling a large database of bus passage time and we would like to allow others application to be able to display certains bus passage time. We would like to use a content provider to do that. Most example seems to be about using an SQL database, but... we use some custom text file. I was wondering what would be the best way to do that. I was thinking I could use a Content Provider and implement the Cursor interface on a custom object that I would manually fill with my text data. Would this be possible ? Anyone have a better idea (excluding changing to SQL lite of course) ?
Thanks in advance.
Would this be possible ?
Sure. ConetntProvider is, in effect, a facade, not dictating all that much about the internal implementation.
The key will be documentation. If you are not using SQLite as a data store, you most likely will not be supporting full WHERE clauses for query() and such. Hence, you need to make sure that whatever you do support for WHERE clauses, available columns, and the like, you document it well, so developers integrating with your content provider know how to do it. Otherwise, they may make faulty assumptions.

Categories

Resources