0

My project consists of one TabView ,in this TabView we have 3 tabs i.e. (HOME, SEARCH, BACK).

There is some problem in back button, in HOME tab we use a TabGroupActivity.

When i press the BACK tab then we can go to last activity, and also set tab at the 0 position means(Home) when we press BACK tab

Reno
  • 33,594
  • 11
  • 89
  • 102
Girish Patel
  • 1,270
  • 4
  • 16
  • 30

3 Answers3

0

You need to supply custom behavior for the Back button. I recommend that you see this question for a discussion about changing a key's behavior.

Community
  • 1
  • 1
Shade
  • 9,936
  • 5
  • 60
  • 85
0

It sounds like you want to overload what the "Back Tab" button does when it gets pressed.

In the example you gave, there are two situations, one when the Home tab is currently active and one when another other tab is active.

This can be done with a simple toggle that is set depending on which tab is currently active. Since each tab, I assume, is an activity, this toggle will need to be global. Then, in the "Back" activity, you would then check for this toggle and either destroy and setCurrentTab(0).

Ricky Ng
  • 56
  • 2
0

you can put Backpress keyevent in Tab Activity and then user can go back to Activity