0

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 that 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!

Nikola Despotoski
  • 49,966
  • 15
  • 119
  • 148
Georg
  • 3,664
  • 3
  • 34
  • 75

1 Answers1

0

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.

Community
  • 1
  • 1
Anand Sainath
  • 1,807
  • 3
  • 22
  • 48
  • I also thought about that... The problem is that I'm not an Android user... so I thought that a android user would expect something different?!? How would you realize a autosuggest with that solution during the typing? – Georg Aug 11 '11 at 12:44
  • I have been using android for sometime, and I am accustomed to see such search screens. For auto suggest, you will have to override onKeyPress of the editText and keep sending requests to another API that will give you a response, preferably again through asynctask and you will have to show them. I dont know any other way possible. – Anand Sainath Aug 11 '11 at 13:47
  • and i show them in a ListView that will only be visible during the search? thanks a lot for your help! – Georg Aug 11 '11 at 14:25
  • No problem George. Happy to help! – Anand Sainath Aug 11 '11 at 16:12