how to reload the activity when tab is select again? please give me a example code..when i press the tab it give me old output but i want to reload that activity for new updated output so please help me Thanks a lot.
Just use .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
to your tab class
Example
tabHost.addTab(tabHost.newTabSpec("Your Tab")
.setIndicator("tab indicator")
.setContent(new Intent(this, TabClass.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
You can use onWindowFocusChanged method also if you need to do add some more process when getting the focus for a particular tab..
@Override
public void onWindowFocusChanged(boolean hasFocus) {
// TODO Auto-generated method stub
//You can add your own method to refresh data within the tab //(Ex: refreshData())
super.onWindowFocusChanged(hasFocus);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With