android: Reload activity or refresh the view on spinner item selected,
I have an activity in which I have added a spinner, depending on the value selected of spinner I have to update the whole view immidietly,
this operation includes changing the locale (use of resour开发者_StackOverflow社区ce) and changing the background color(use of some local private variables).
I have tried onItemSelected
and tried to reload same activity by calling startActivity
, but it causes the same activity to be reloaded every time and can't let perform ui operation.
I have also tried onResume
onWindowAttached
methods but I could not figure out what to do there to reload activity. So I just called setContentView
but it did not update the UI properly (Sometimes the locale is not applied and reset to default english or sometimes the wrong color is applied in background.)
There was no crash, no exception thrown.
I need your help to accomplish this task
Thanks
Just update the Ui components and not the entire activity on onItemSelected
.
精彩评论