Ken Vors
Ken Vors

Reputation: 197

How to refresh a view in Android

In my android application, in a view, there are RadioButton view, TextView, Checkbox view, date picker, clock picker and so on.

at the bottom, there are two button. One of them is add and the other one is reset. I want that when the user click to reset, that should naturally refresh the whole view and all values in childview should be set to the default value. How can I achieve that ?

Thank you very much for your help..

Upvotes: 2

Views: 14883

Answers (2)

Kartik
Kartik

Reputation: 7917

This is not the right way but I think it should do the job for simple cases:-

Restart your activity without animation.

finish();
startActivity(new Intent(this, MyActivity.class));
overridePendingTransition(0, 0);

Upvotes: 2

user3453281
user3453281

Reputation: 599

ViewGroup myViewGroup = (ViewGroup) findViewById (R.id.myId);
   myViewGroup.removeAllViews();
   myViewGroup.refreshDrawableState();

Upvotes: 1

Related Questions