Currently I am working on Android TV app.
I have used Android Lean back support library.
I have added one ListView
, but I can not able to select any of the item from listView with real device's remote. However, I can able to select item of listView on my Android Virtual Device with the help of mouse.
Here is my sample code of listView:
customViewOrders = new CustomViewOrders(getActivity().getBaseContext(), arrayViewOrders);
lstViewOrder.setAdapter(customViewOrders);
Here, arrayViewOrders
is my ArrayList which contains data received from JSON webservice.
Here is my JSON Response:
{
"order":[
{
"0":"13829CF",
"gen_id":"13829CF",
"1":"17534CF",
"2":"Complete",
"ord_status":"Complete",
"3":"Online Preview",
"sta_name":"Online Preview",
"4":"2015-10-27 00:00:00",
"image":"cinereel",
"placed_from":"web"
}
]
}
I have also added following features in AndroidManifest.xml file:
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.hardware.faketouch"
android:required="true" />
So, my question is: how to select anything (i.e. list item, button) in real device with the help of remote?
Sometimes, the issue can be with the app version or installed app on your phone. In such cases, the best way is to reinstall the app and see. Since we cannot be sure what is causing the Android TV Remote app not working issue, we advise you to uninstall the app and install it again.
Google has confirmed that it's getting rid of the Android TV remote app. The app will leave the Play Store as a remote is integrated into the Google TV app.
Set up your virtual remote On your Android phone, open the Google TV app . Near the bottom right, tap Remote . At the top, tap Scanning for devices. Choose your device.
Your phone needs to be on the same Wi-Fi network that the Android TV or Google TV device is connected to. Then, fire up the Google TV app, tap the new floating action button for the remote that you should see, grant the app some location permissions, enter a pairing code, and you'll be taken to the new remote.
Finally I got the solution after lots of R&D.
Here is the my solution for directional navigation using Android TV remote.
Firstly, you have to keep focus of any one of items (i.e. Button
, TextView
, etc.) as below.
And also, you have to apply its nextFocusDown
, nextFocusLeft
, nextFocusRight
& nextFocusUp
properties, so that it will fire its relevant event when you click TV remote navigation buttons.
<Button
android:id="@+id/btnSignout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvUserName"
android:layout_marginTop="2dp"
android:layout_toLeftOf="@+id/ivUser"
android:width="100dp"
android:nextFocusRight="@+id/ivUser" <!-- On click of right arrow button, focus will be move to ivUser id -->
android:nextFocusUp="@+id/tvUserName" <!-- On click of up arrow button, focus will be move to tvUserName id -->
android:text="@string/signout"
android:textAppearance="?android:textAppearanceMedium">
<requestFocus></requestFocus>
</Button>
For more information, you can refer to:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With