I'd like to allow users to type in an address in my Android app. The Google app provides a nice street address input field to allow the user to enter their home & word addresses. As a street address is being typed, incremental suggestions appear below the text input - an example is shown in the image below. How can I do something similar in my app? Is there a widget that does this?
Well only if you have a way of searching as the user types in the address. Like onTextChange event of the edit text! you can push query to some server say google maps that provides for the auto-completion on partial query strings.. or if you have a local datastore of previous searches you can provide auto completion on that as well but it'll be very limited.
I ended up using this example code:
https://github.com/googlesamples/android-play-places/tree/master/PlaceComplete
Hope it helps somebody else!
Related
So I am building an floating application that would allow user to browse webpages and allow them to listen audio from video sites like YouTube, etc. even when the device is locked/in background. Here I have a text box where user can input the websites or any text that they want to search i.e. SomeSite.com, www.SomeSite.com, Some Text To Be Search
I want to know is there any efficient way to do this. Currently I am thinking differentiating this by counting space in text (if there is 1 or more space then text is definitely not URL). But this won’t work for 1 word search query. Also another way is to check for top level domain like .com, .in, .uk, etc. not good as there could be thousands of domains and in future also it could increase.
I just want a effective to differentiate site or an web address
You can use the Patterns class available from API level 8.
if (Patterns.WEB_URL.matcher(myUrl).matches()) {
// Go to website
} else {
// Submit as search query
}
You can use
isValidRul()
Patterns.WEB_URL.matcher
Check if Uri.parse() returns valid value
i trying to implement auto search mechanism in android like google. Here when i enter some words then display related search results in list view. For example i entered 3 letters then display related search results from server, again i will add another letter to previous 3 letters then automatically display related search results with out click search button.I don't know how to do it, every time api calling. How to use Search view option from android xml for searching?
On client side you should with the help of AutoCompleteTextView, Adapter, HTTPClient and other stuff you handle sending a request to server. On server side you implement Filter after querying database. After filter is done - respond result and via AutoCompleteTextView you show suggestions. Then via Adapter you set list.
Very nice example
Now when you know which way to search better use google. It is rich on that kind of info and if you face some problems - ask new question with exact! problem.
hope it is helpful.
I am building an app that makes use of phone numbers. I would like to have a user select a country and then based on that country prepend the country code to their phone number.
Is there a standard way for doing this in android? I thought the answer was Place AutoComplete, an android service for adding places, but that does not seem to be the answer; at least I can't get the country code from that service as explained on The Google Developer Academy site.
Does anyone know how I might get this done?
You can use this library by google for handling phone numbers on android. You will need to send the country code once the user selects and then use the PhoneNumberUtil.getInstance().parse(,)
In Android Google Mail app, when you start typing into the "To:" field in a new email, you will get a dropdown menu, auto-populated from your contacts.
I want this behavior in my app.
Currently, when my users enter an email address, they have to type the whole thing (into, essentially, an "textEmailAddress" input field). I want to make things easier by providing contacts-based predictive entry, Google-Mail-style.
How do I do this?
(So far, I have 1. googled, 2. looked through Android SDK documentation, 3. looked through Android sources (http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/).)
You have 2 things to do
1) Get All Contact's Email ID See this Blog and Also can Search for more exapmles
After getting the Email IDs Store them in An Array say emailArray
2) Use the emailArray to show in an AutoCompleteTextView
I can specify a square where the Geocoder shall search in, but I found no way to specify a certain country. Unfortunately, my country isn't quadrangular ;( What should I do? Use another reverse geocoding service?
I'd want to build a search box where the user can search for a city (with auto suggestion). On every keystroke the current search query is going to be delivered to the Geocoder.
If it's any help, the official Geocoding API can do regional biasing. It would require you to use their web API instead of the Android API.