Closed psandroiddev closed 3 years ago
Did you try calling .requestFocus on the grid?
actual problem is on first time focus on the grid we are not getting any callback from library. like if we go to some other view and then come back to this program grid the focus is there but we cannot get any callback
Isn't that because the grid is not showing any items yet because it is still loading? That might be your issue. You could check the load state, and if it is loaded, put focus on the grid. Until then, you can put an hidden view behind the grid and request focus on that.
Data is present and the grid is loaded
When do you call requestFocus exactly? What is the trigger?
at first when data is loaded. Then just navigating using dpad back & forth into the programguidegrid view
Yes, but how do you detect when data is loaded. You should not request immediately, because the RecyclerView needs to load its data, check for diffs, and create the views. Please try delaying the requestFocus with about 100-200ms, that should solve it.
Closing since no response. Feel free to reopen if you have further comments.
In my app there is toolbar at top so when I open the activity first time focus goes to the Search icon & then goes down to the particular current program with focus .But I want initially focus goes to current program not to the Search icon on toolbar.