How can I get the text entered into a search box in android?
-
I am creating my first real android app. I have an action bar with a search widget in it, and I do not know how to get the entered search term and do something with it. I want to be able to get the search term then query it to an online api and return the results in a list view. Here is my code so far: My main activity looks like this: http://pastebin.com/Pi4zJpRT and I am getting this error: The method setOnQueryTextListener(SearchView.OnQueryTextListener) in the type SearchView is not applicable for the arguments (new OnQueryTextListener(){})
-
Answer:
To fix this error, try importing OnQueryTextListener class. Would recommend you to look into android sample application - SearchableDictionary that comes with the Android SDK samples and this tutorial - http://developer.android.com/training/search/index.html Though this tutorial shows you how to create a SQLite virtual table that is populated from "definitions.txt" file inside resources/raw folder, you can modify it to fetch data from an online database.
Ashita Agrawal at Quora Visit the source
Related Q & A:
- How can I get an overseas job as a civil engineer?Best solution by jobs.monster.com
- How can I get tickets for the serie a Torino-Juventus derby?Best solution by Yahoo! Answers
- How can I get my regular avatar of a real picture back as my avatar instead of the one now?Best solution by Yahoo! Answers
- How can I get rid of blackheads with a home remedy?Best solution by top10homeremedies.com
- How can I get AT&T Yahoo as a home page?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.