I am putting focus on a view but when I change orientation the focus is lost from that view .
does onConfigurationChanged() handles focus?
or i need to explicitly set it and if yes then how can I set focus ?
I need to keep track of current focusing view .how to do that?
I am putting focus on a view but when I change orientation the focus
Share
Override the onSaveInstanceState and onRestoreInstanceState methods in your Activity. You can then keep track of whatever view has focus by grabbing the ID of the view and saving it to the Bundle in the onSaveInstanceState method. Then in the onRestoreInstanceState method, you just grab the ID and find the view with that ID. You don’t even need to cast it or anything. You then just request focus for that view. It will look like this: