Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TV App - unable to select list item with remote

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?

like image 620
Jay Rathod RJ Avatar asked Jan 11 '16 11:01

Jay Rathod RJ


People also ask

Why is my Android TV remote app not working?

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.

What happened to Android TV remote app?

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.

Can I control Android TV remotely?

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.

How do I use the new Android TV remote app?

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.


1 Answers

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:

  1. Android User Interface Design: The Basics of Control Focus Order,
  2. Creating TV Navigation.
like image 53
Jay Rathod RJ Avatar answered Oct 20 '22 18:10

Jay Rathod RJ