question

newuser-74b6aed8-2460-4117-aee8-7d0cec129408 avatar image
newuser-74b6aed8-2460-4117-aee8-7d0cec129408 asked ·

How to focus on the ListRow Item which is not focusable on Firestick 3rd Generation( Android API 28) via the remote

0

I am developing an app using leanback architecture where a certain custom view is not focused using the dpad of remote.

The onFocus() of the custom view doesn't get called in FireStick version 3(Android API 28) . The same code gets triggered on lower versions( < Android API 28)

The custom view is a ListRow for showing genres of movies which is being fed data by GenrePresenter.


genrePresenter = new GenrePresenter(new GenrePresenter.viewListener() {            
@Override
public void onClick(View view, String selected) {                
((HomeFYCActivity) getActivity()).showAdapter(viewModel.genreList, selected);            
} 
//THIS DOES NOT GET TRIGGERED ON API 28            
@Override 
public void onFocus(View view, Boolean hasFocus) {                
// NEED TO SET FOCUS HERE
}
}, "ALL GENRES");
header = new HeaderItem("NOW PLAYING");
genreRow = new ListRow(header, genreRowAdapter);

But instead the HeaderItem gets the focus.

Same code works on < Android API 28

fire tvapidevicesgeneral coding
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Arun@Amazon avatar image
Arun@Amazon answered ·

Hi there,

It looks like you already resolved this yourself. I am posting a link to the solution here, in case other developers encounter a similar issue

https://stackoverflow.com/questions/68183099/how-to-focus-on-the-listrow-item-which-is-not-focusable-on-firestick-3rd-generat#comment120733198_68183099

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.