Reputation: 15525
In my app I have used the following code to close and restart my current activity. But my problem is, I have used 3 tab activity as nested. total 9 activities. so while using the following code my app loading too slow. I think there is a smarter way than this. If anyone knows please suggest me friends.
LocalActivityManager manager = getLocalActivityManager();
String currentTag = tab.getCurrentTabTag();
Class<? extends Activity> currentClass = manager.getCurrentActivity().getClass();
manager.removeAllActivities();
manager.startActivity(currentTag, new Intent(MainActivity.this,currentClass));
Thank you.
Upvotes: 0
Views: 232
Reputation: 15525
INTENT.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
This command simply restarts all activity without any problem.
Upvotes: 0
Reputation: 3915
I suppose the "smarter" way here would be do not use deprecated class TabActivity
and for sure do not nest several TabHost
. You probably should use Fragments
and at least something like FragmentTabHost.
Upvotes: 1