Reputation: 4414
i have a edit text and when i search the results are fine. but if i back press and come back the result remain the same, rather how to clear the edit text and load the fresh list.. help me please thanks in advance.
Upvotes: 0
Views: 1116
Reputation:
public void onResume() {
super.onResume();
searchBox.setText("");
}
try this one
Upvotes: 0
Reputation: 25864
You should check if the activity is being reloaded by checking the Bundle in onCreate():
In the Activity containing the EditText you want to blank when you go back to it you need this:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EditText searchBox = ...
if(savedInstanceState != null) {
searchBox.setText("");
}
Upvotes: 2