I have two tabs. In these two tabs I have different activity groups. How to navigate from an activity in one activity group to another activity in android? Please help me wi
in my case i did like this when i click on finish/submit button in last activity of parent group ,,i submitted values(storing values into server /database ) and i finished parent activity like getParent().finish();, and starting tabs activity and setting current tab like setCurrentTab(int)
it may not best approach but it may useful
sorry for my language
To programmatically switch between tabs use the TabHost
method setCurrentTab(int index)
or setCurrentTabByTag(String tag)
. The user can also click the tab UI (if used) to switch between them.
The best way of handling this is to use
startActivityForResult(intent, int);
Along with overriding your activity's
protected void onActivityResult (int requestCode, int resultCode, Intent data)
Whenever you're activity finishes, you will want to set the result to a certain code:
public final void setResult (int resultCode)
When the activity finishes, the previous activity's onActivityResult call will be invocated with the result code passed. Here, you can check for the result code and request code and then perform an action. In this case, you will want to do a cascading activity pop until you reach the first activity in the list. You can then set the result for this previous activity and finish it which will then trigger the next activity's onActivityResult. You can then do this until you reach the 'first' activity in your activity stack.
This method is also flexible because it lets you conditionally pop to certain points in your activity stack depending on how you handle the request code and result code.