0

Im still a newbie in android, would appreciate your help as I couldnt find any info on this.

I have a TabHost with two activities assigned. Tabs are "shops" and "people" Both Activities contain ListViews. Now.. If I click on one of the elements of the ListView I would like to "shoes/people" tab to remain still while only contents of Frame to change (where listView is) so that at any given time I can switch back to other tab and start process from begining.

Currently after user clicks on listview item

Intent merchant = new Intent(v.getContext(), MerchantView.class);
startActivity(merchant);

a new Activity is started (Tabs dissapear) and view completly replaced.

Questions :

  1. copmpletly full new view is created when I click on ListView item. How can i run this MerchantView Activity only within Frame?

  2. This MerchantView will then have another clickable element which again I would like to behave in similar way (Tab remains still).Is my approach here good?(to change activites per click). I mean maybe instead of running new activities for every screen I should change a view in some way

thanks!

AndroidGecko
  • 14,034
  • 3
  • 35
  • 49

1 Answers1

2

Instead of starting a new activity each time an item is clicked, and you want to use the same view..Why not when the button is clicked you just inflate the new information into the view, instead of launching a whole new activity. This seems like the best solution.

coder_For_Life22
  • 26,645
  • 20
  • 86
  • 118
  • Hi, thank you for your hint. After a while it turned out that functionality will be much complex so i ended up using tabHost with Fragments (http://stackoverflow.com/questions/6987334/tabs-in-android-using-fragments) – AndroidGecko Feb 01 '12 at 10:06