I have a complex TabActivity that contains ListViews and TextViews. Instead of messing up with manual UI update I decided to "recreate" activity (force full redraw) whenever it comes to foreground. Assume that i navigate from activity A to B. When hit back on B, activity A must be recreated. Here is the code:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
setupTabs();
}
@Override
protected void onNewIntent(Intent intent) {
startActivity(intent);
finish();
}
@Override
protected void onRestart() {
super.onRestart();
onNewIntent(getIntent());
}
It works, but i wonder if i am doing something wrong, maybe there is a more elegant solution. Could you please suggest best practice for this scenario?