I would like to ask if my concept of implementing search in my application is correct and whether it could be improved. I will provide any details needed therefore I believe my question is well-suited for this site.
I need to implement a search over large SQLite tables (~20 columns,
possibly 1000-1500 records - you can think of it as a catalogue of
items in a supermarket). The search should be performed on more than
1 table (i.e. 1 catalogue) but I can also force the user to choose
specific table (though I would like to avoid it).
To make the search efficient, I'll use the SQLite FTS3 tables.
I want to make a fast search that will quickly show results as the user types a query string. For example, when a fragment of
product manfufacturer is entered all of the products matching that
string should be shown. The perfect solution would be if the user
could enter fragment of one column and fragment of another at the
same time, though I think that could be a little too much for an
Android device.
Questions:
Should I use a SearchView together with a a ListView (and show search results in the ListView) or should I use the AutoCompleteTextView?
Are the FTS3 tables the right way to go (i.e. will it be fast enough) to effectively perform search over several (large) tables?
I am targeting Android versions >= 3.0.
If you want to have a few line of code, you should use AutoCompleteTextView for it has ready built-in listener (ontextChangelistener -- wherein you can show the suggestions every time the text changes ) and list/ container for suggestions.You can create your own adapter to customize the design of the list.
FTS3 or FTS4 would be great in querying big amount of data.
Related
I'm building an app with linear and relative layouts to create lists. I want to have a search function to search through text fields and return the results with "links" to the pages it pulls the results from.
I don't know if I am explaining this well enough, but that's what I need help with. I can find all sorts of search help but it all seems to revert back to ListView's.
You should aim to create your "lists" from some form of data-store. Usually a database, see SQLite Databases in Android. You should then use the query language to return only fields that match your search term e.g. "SELECT * FROM people WHERE name = 'Adam'".
To directly answer your question, the searching of text fields (EditText's or TextViews) is not possible to do automatically and you would need to hard code the search for each individual one.
This is not a pure programming question; rather it has to do with implementation details. It is required to implement an order processing screen where a customer makes an order consisting of multiple items. It is a two step operation whereby the user has to enter the name of the customer (or pick a name off of a list) and enter the order details (detail block in db terminology) and likewise enter the items or pick them off of a list. How is this transaction best carried out on an Android device?
(Please note that I am not asking about the programming of db operations rather about what objects are needed on the layout in order to implement such a transaction.)
About the implementation (no code), I am trying to give the most simple yet an efficient way to do this.
Give the user a choice (maybe buttons) to either enter name of customer or choose from a list.
If the option is to enter the name, some TextViews and Buttons would do the trick.
For choosing from a list, try a ListView.
On clicking any of the ListView terms, an Activity with TextViews and Buttons to take the order details.
For choosing the items, provide a Dialog Window with check boxes beside each item names.
Hope this helps. Get back to me if you need any help with the code.
New to android development. I recently finished the lynda.com tutorials, but want to get more involved. I was thinking about doing an app that shows various quotes from movies, but am in need of some guidance. I just want it to have one activity and am going to have a next and previous buttons at the top. How would I create the app that shows quotes in a randomized order and keep the quotes on the same screen?
Thanks for any and all help!
Create an SQL Database and store your strings in the table and display it using list view.
http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/ - tutorial for database.
Your request is essentially just a basic layout question: Create a basic view, lay it out with a text field and two buttons. Create either an array list of strings or an SQLite database (as detailed by user3245033). You will then need to add listeners to both buttons (http://developer.android.com/reference/android/widget/Button.html). The next button should generate a random number that becomes an index into the list or database storing your quotes, the back button should store the previous index value (so that you can go back to the same quote as opposed to a random quote). When you're retrieved your quote, set the text field to that string.
There are many basic examples that demonstrate this type of work. mybringback on YouTube particularly amazing:
http://www.youtube.com/playlist?list=PLB03EA9545DD188C3
I am working on app which have data entry form which have
Some fields with 3 drop down associated to it.
More then 25 input fields (input box, radio button, drop downs etc)
All input fields are grouped into 3 categories
My question are:
How to display field with 3 drop downs associated with it ? Because of a small screen size it cannot be displayed horizontally.
What is the best way to represent 25+ fields ? I tried scroll view and tabs but don't find it so pleasing.
For example if you consider date then it may have three drop downs for date , month and year. (Its just example I have fields different than date)
What is the good way to have fields in a category together with appealing UI.
PS: My app is related to Hospital so it has to be pleasant .Which also means I cannot use glossy background or image.
You might want to check this site for general Android UI design ideas. Here are some for your particular cases:
re-design your UI to only show what is needed. It's unlikely that all 25 fields are used all of the time. Consider separate screens for different use cases, and/or some sort of wizard-like UI (fill in the basics, press next, fill in details, etc.)
if you really need to display all of this, consider using a tablet, not a phone to run the app (assuming this is to be used in the field, and you have some control over devices).
instead of tabs, you might want to try something like ViewPager. It doesn't take as much space as tabs, and the number of views is practically unlimited.
Maybe like this...
You can use the library QuickAction which allows to create some kind of context menu.
To keep a simple screen view, you can only display the current values. Several on the same lines for the same category.
Then, if the user click on a value or category, you trigger a QuickAction with the actions available for the category or values: Edit, clear, ...
For each action, you can also show a dialog to update/fill the field which has triggered the action...
I am developing an application where a list of words are shown..The list very big and user can select any one of the items in the list..I would like to provide search functionality where user can type in a keyword(part of the word) and a only matching items need to be displayed..Any idea of how to do this?
Well... the AutoCompleteTextView has been a part of the Android API since day 1... it does exactly what you need. You'll have to have your list items in some kind of adapter, but that shouldn't be too difficult to implement.
http://developer.android.com/reference/android/widget/AutoCompleteTextView.html
Edit - And indeed, look at Sanjay's post for a link to a tutorial on using it.