Android Small App-Introduction to the module "Smart Help"

Source: Internet
Author: User

The entire application framework is described earlier, and the details of each module design are described below.

One. " Traffic chapter "

The above three picture is basically the traffic section contains the content, among them, figure 二、三只 involves the use of Android Basic control Expandablelistview, here does not make specific explanation, we focus on the implementation of Tuyi.

1. What is the input box control?

In order to be able to prompt the user input effect, here can not use the most common EditText as input box, Android provides us with an automatic display drop-down hint list of input control "Autocompletetextview", it is best to use here.

2. The control has, then we need to display what data content to the list of controls? Of course, a collection of names matching the pickup point to the user's input location.

3. Following the above questions, we explain the rules and algorithms that match the user's input location name.

-First of all, a place, such as "Dong Pu dong", often have different pick-up locations (a), considering the user input when the first reaction is to enter a place name, so here the matching rules are based on place names, such as "Tianhe District Dong Pu dong" to fuzzy matching all the points in the place of the car, and then to Adapter The form is passed to the input box and displayed to the user.

-Secondly, on the implementation of fuzzy matching algorithm, learning the database will know that there is a string to fuzzy Query database command, the keyword is "where * * * * * * * * * * * * * * * * * * * * * * *

<span style= "FONT-SIZE:14PX;"  >cursor mcursor = Db.rawquery ("SELECT * from" + TableName + "where" + "stop_name" + "like '%" + shortname + "%" and First=1 "+" or location like '% "+ shortname +"% ' and first=1 ", null);</span>

So the problem is, I need to pass the query results in the form of Adapter to "Autocompletetextview", but a normal Adapter, how to query the database returned by the Cursor to be associated with it?

Android gives us a adapter class called "Simplecursoradapter", which is dedicated to data binding, meaning it can be directly associated with the Cursor of the database.

4. Above we solved the user from the input place name, to receive the automatic prompt on the drop-off location, and then to select the location of the need, these questions, then, the user selected to the designated location, click the shuttle search, and how to do the bus route matching it?

I think that if you look carefully at the 3rd on the database fuzzy matching method, this is not a problem, because the fuzzy matching has, and naturally there are exact matches. I will not dwell on it here.

5. About joining the "bus" line query function, at the beginning also carried out a number of ideological struggles, compared to most people's mobile phones have installed Baidu map and other query tools, will be many times a swoop?

Finally consider that after all, sometimes the user opened the application, if suddenly want to search the bus line, at this time to provide such an entrance, not to bother to quit, and then into the Baidu map? In case the user's mobile phone just did not install Baidu map it? With this idea, the feature was added.

Then again, in fact, "bus" query the entrance, is to call the Baidu Map open platform to provide third-party interface, the specific implementation is relatively simple, interested friends can directly Baidu, also do not repeat.

At this point, the "traffic" of some techniques to achieve a brief introduction of the method, in fact, look back, and will not be so difficult, many are some of the basic technical points ready, just put them together to use it.

In the next article, we will introduce the content of "food article".

Android Small App-Introduction to the module "Smart Help"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.