views:

22

answers:

0

Hi,

I have defined a HomeActivity with three tabs and each tab is a seperate activity.I used the example in the android developer site. http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

Tab B's (second tab) UI conatins a text and button (named Search).When the user clicks the search button,it should contact a REST webservice and show the results as a list.

In Order to do this,inside TAB B activity,on the click of the button,i call a method which creates an intent and calls a new SearchResultsActivity(referring as SRA henceforth).Inside the SRA(extends List Activity),i have the logic for connecting to the webservice and parsing the JSON result returned which displays the results as a list.I am able to achieve this functionality.But i see some drawbacks here and my questions are:

  • Is it fine to define a new activty (SRA) to handle the search results? or would it be better to have it handled in TAB B activity itself?The main reason why i went for a seperate activity is,the SRA extends ListActivity which would be needed if i want to display it as List and TabB is just extending Activity and wouldnt allowme to display teh results.So,is there a better way to do this?

  • Given the above implementation,when i navigate from TabB (click search button) to SRA,the tabs are not seen anymore.As TabB is calling a new activity( Intent srchIntent = new Intent(TabB.this, SearchResultActivity.class); TabB.this.startActivity(srchIntent);),the tab goes away.What could be the best solution in this case so that the tabs appear/results shown within Tab B ?

  • While navigating from TabB to SRA,i am trying to show a Progress dialog/Loading defined in TabB before calling StartActivity and cancel it afterwards.But the loading icon does not appear.I have tried showing the dialog and canceling in SRA as well.But the loading does not appear.