Display the results of a search in the same intent that it was started from
I have a simple Android application that has a TabBar and one of the tabs displays a list. This should be the results from a Web-API Call
.
When the user hits the "Search" Button on the phone, a new search should be triggered. I had a look at the example on the android developer pages: http://developer.android.com/resources/samples/SearchableDictionary/index.html
My problem now is t开发者_开发问答hat the result will be displayed in a new instance of the results intent. This also makes the TabBar on the top go away. Is there any possibility to display the search result in the intent that was active when the user triggered the search?
I tried messing with the android:launchMode
in the manifest file... but no success :(
Any help is appreciated,
Thanks a lot!
You can get the same look and from the following.
1) Have a search layout that will contain a bar on the top [a editText and a Button] and a linear layout within a Scrollview below it.
2) Once the user enters a query and presses the button, call an AsyncTask to fetch the result you want from the Web-API.
3) Have another layout that will show the details of each search result [in the case of your example : a word and its meaning].
4) Once you have the result returned from the AsyncTask in a suitable format [ArrayList..], you can use the LayoutInflater to add your results to the LinearLayout that you had kept inside the ScrollView in the mail layout.
5) Next time you press search , remove all Views from the particular linearLayout and repeat steps 2-4.
精彩评论