Android Search in other languages based on pronunciation - android

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.

Related

Android - find image link API

Hey !
I have an Android app where the user can search on a specific subject, let's take the word "Cats" for example. When the user submits the search I want to find an image similar or on the subjects the searched for. A search engine for images more or less. I want something "easy" to deal with, so I thought about integrating the Google Search API into my app. Let the user search Google, and take the first image that comes up.
However, I haven't found any example and I just need a push in the right direction. If you could give me an example API for my needs, that'd be great.
Apparently the Google Search API never was fully deprecated it's still up and running. It provides JSON data and is easily parsed with Android.
If anyone else needs an image API here's a test search: https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=searchquery&rsz=8&start=1&imgsz=small|medium
And the JSON reference: https://developers.google.com/image-search/v1/jsondevguide

How to get a list of locally stored phone contacts with App Inventor 2?

So wasn't sure how to title this one but I'm hoping someone with Android experience can answer this for me.
I'm trying to turn Android code into App Inventor 2 code. I need to start a new activity and have the relevant Action, ActivityPackage, ActivityClass, DataType, ExtraKey, ExtraValue (whether all of these are needed for this specific situation I'm not sure) to input into an ActivityStarter that views the locally stored phone contacts.
I am sure there is a way, there is in just Android app making with Java but I need help translating that code across. I'm pretty sure I want an android.intent.action.VIEW and contactsContract.CommonDataKindsPhone I'm just not sure in which parts in should go and what else I need to than be able to add that information to a list.
This is what I have so far:
I'm sure others would appreciate this information, as well as how to get other related data to contacts into App Inventor 2.
Also I know about ContactPicker.PhoneNumberList and PhoneNumberPicker.PhoneNumberList neither of which are able to find any contacts on my phone which is why I'm trying to work out a work-around.
Anyway any help is appreciated,
Thanks.
Unfortunately it's not possible to get a list of locally stored phone contacts with App Inventor. See also issue 734 in the Issues List. I suggest you to star this issue, so probably one day we get this feature into App Inventor.
The ContactPicker.PhoneNumberList or PhoneNumberPicker.PhoneNumberList only give you all phone numbers of a contact after picking a contact.
App Inventor has its limitations and unfortunately you can't do something like this as described in this Stackoverflow answer. The only thing you can do is to access the Google Contacts API with the web component to get a list of contacts, but precondition is, your contacts are synchronized with Google, but this is not what you want. An example to do that you can find here.

Android's query suggestion

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

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.

Categories

Resources