Android TV App - unable to select list item with remote - android

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?

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:
Android User Interface Design: The Basics of Control Focus Order,
Creating TV Navigation.

Related

Android App actions issues when English Articles are used as a part of speech

We have implemented android shortcuts. Testing of App actions on physical devices was fine, except for an issue with English Articles.
When English Articles appear as a part of a statement, the statement is not recognized as an action, and Assistant does not redirected to the app. For example, 'add note to Express Scheduler' is recognized, while 'add a note to Express Scheduler' is not.
My question is whether anybody have experienced similar issues?
Please, see capabilities segment extracted from shortcuts.xml. I am using actions.intent.CREATE_THING and actions.intent.GET_THING BIIs. I've listed one example above: 'add note to Express Scheduler' is recognized, while 'add a note to Express Scheduler' is not.
<capability android:name="actions.intent.CREATE_THING">
<intent>
<url-template android:value="https://vijac.ca/schedule{?name,description}" />
<parameter
android:name="thing.name"
android:key="name"
android:required="false" />
<parameter
android:name="thing.description"
android:key="description"
android:required="false" />
</intent>
</capability>
<capability android:name="actions.intent.GET_THING">
<intent>
<url-template android:value="https://vijac.ca/search{?name}" />
<parameter
android:name="thing.name"
android:key="name" />
</intent>
</capability>enter code here
Thank you!
I think what may be happening is that you have a very generic name of the thing ("a note"), when it is expecting to handle specific names which normally don't need an article ("Pixel 4", "Stairway to Heaven").
You may want to try one of these to address the problem:
The thing.name parameter for that BII allows for an inline inventory which is a way of setting allowable values and alises for those values. You can create an inventory item for note that has aliases such as "a note" and "note".
Consider using the actions.intent.CREATE_DIGITAL_DOCUMENT BII which indicates that it supports phrases such as "Create a note".

Street view is showing error message in android app

Hi Am working on google maps. i have added location in a fragment now am trying to add StreetViewPanoramaView to the fragment . But am getting Oops! something went wrong error message as shown in 2nd image
this is my code
maps_activity.xml
<Button
android:id="#+id/button_streetview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Open StreetView"
/>
<androidx.fragment.app.FragmentContainerView
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".MapsActivity" />
<com.google.android.gms.maps.StreetViewPanoramaView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/streetview"/>
This is my MapActivity.kt
button_streetview.setOnClickListener(View.OnClickListener {
var mStreetViewPanoramaView : StreetViewPanoramaView = findViewById(R.id.streetview)
mStreetViewPanoramaView.onCreate(savedInstanceState)
var streetViewPanorama: StreetViewPanoramaOptions = StreetViewPanoramaOptions()
streetViewPanorama.panningGesturesEnabled(false)
streetViewPanorama.position(address)
streetViewPanorama.userNavigationEnabled(false)
streetViewPanorama.zoomGesturesEnabled(true)
var streetViewPanoramaCamera : StreetViewPanoramaCamera = StreetViewPanoramaCamera(25F,30F,1F)
streetViewPanorama.panoramaCamera(streetViewPanoramaCamera)
mStreetViewPanoramaView = StreetViewPanoramaView(this,streetViewPanorama)
mStreetViewPanoramaView.getStreetViewPanoramaAsync(this)
})
i can successfully retrive latitude and longitude of a place by address and display it in infoWindow and add custom marker as shown in image.
But when i click openstreetview button error message is coming.
This is the StreetView
This is the logcat
As This Error message is showing Wrong API key but i have added correct Key as i can retrive and display a marker successfully. Can anyone please tell me where am doing wrong
It looks like you are getting the error described here:
If you receive an error such as Your card does not support automatic
recurring payments or General decline of the card, please select a
different form of payment.
You might encounter these errors if you are using a debit card that
requires two-factor authentication to complete an online transaction.
Two-factor authentication requires you to be in-session at the time of
the transaction. Cards that require you to be in-session are not
usable for subscriptions or similar recurring automatic transactions.
Your street view map should work without problem once you enable billing on your project. Hope this helps!

show VR tour in android

I want to show VR tour like this http://alfavr.ir/alfavr.ir/to/park.html in my Android app.
how can I do that?
I tried to display with web view because the file format is Html but did not work.
You can try with VRPanormaView which is included in the Google VR SDK. This is an example from https://developers.google.com/vr/develop/android/vrview:
<com.google.vr.sdk.widgets.pano.VrPanoramaView
android:id="#+id/pano_view"
android:layout_margin="5dip"
android:layout_width="match_parent"
android:scrollbars="#null"
android:layout_height="250dip" />
Inside the Activity, the primary method is VrPanoramaView.loadImageFromBitmap(). Call it with a standard Android Bitmap object and an optional VrPanoramaView.Options object. The latter is used to configure the format of the image. The Activity also implements a VrPanoramaEventListener which receives events when the load operation succeeds or fails.
Adding this line make It work.
webView.getSettings().setJavaScriptEnabled(true);

Google +1 button in Android app does not change count

I followed the standard procedure to add a Google plus button:
<com.google.android.gms.plus.PlusOneButton
xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
android:id="#+id/plus_one_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
plus:annotation="bubble"
plus:size="standard(none)" />
It is linked to the app's Google Play page. It is initialized in onResume as recommended:
_PlusOneButton.initialize("https://play.google.com/store/apps/details?id=net.mydomain.myapp", 0);
The button gets the count correctly initially, but the count never changes. The Google Play page shows the count keeps changing (increasing) as expected. I have been curious about activityRequestCode in initialize (String url, int activityRequestCode). I do not know what it does.
Could anyone shed some light on this?

asp.net child menu items dissappear on android devices

In 2 seperate web applications, one using asp.net 3.5 with vs2008 and 4.0 with vs2010, the child menu items of an asp.net menu dissappear only on android browser. When the main menu item is clicked the children flash for a split second then dissappear.
Edited version of menu is as follows:
<asp:Menu ID="MainMenuEmp" runat="server" CssClass="menuASP" Orientation="Horizontal" DynamicHorizontalOffset="0"
StaticDisplayLevels="1" StaticEnableDefaultPopOutImage="false" DynamicVerticalOffset="1" visible="false"
>
<StaticMenuitemStyle CssClass="menuitemASPStatic" />
<StaticHoverStyle CssClass="menuASPStaticHover" />
<StaticSelectedStyle CssClass="menuASPStaticHover" />
<DynamicMenuStyle CssClass="menuASPDynamicMenuStyle" />
<DynamicMenuitemStyle CssClass="menuitemASPDynamic" />
<DynamicHoverStyle CssClass="menuASPDynamicHover" />
<DynamicSelectedStyle CssClass="menuASPDynamicHover" />
<Items>
<asp:MenuItem Text="HISTORY" Value="#" navigateurl="~/clientpages/jobhistory.aspx" />
<asp:MenuItem Text="NEW ORDER" Value="#" navigateurl="~/clientpages/newjob.aspx" />
<asp:MenuItem Text="CLIENT INFO" Value="#" navigateurl="~/clientpages/clientinfo.aspx" />
<asp:MenuItem Text="MGMT" Value="#" Selectable="false" >
<asp:MenuItem Text="Inspections" Value="#" navigateurl="~/clientpages/MgrInspection.aspx" />
<asp:MenuItem Text="Tasks" Value="#" navigateurl="~/clientpages/MgrInspectionStatus.aspx"/>
<asp:MenuItem Text="Last Vehicle Inspection" Value="#" navigateurl="~/clientpages/MgrInspectionVehicle.aspx"/>
</asp:MenuItem >
<asp:MenuItem Text="JOB MGMT" Value="#" navigateurl="~/clientpages/jobdailyview.aspx"/>
</Items>
</asp:Menu>
partial css is as follows: (z-index is needed to get sub menu's to show on other browsers).
.menuASPDynamicMenuStyle
{
z-index: 999; /*padding: 4px 0 3px 0;*/
padding: 0;
margin-top: 1px;
background-color: #F8F8F8;
}
Menu is on master page with toolscriptmanager on page.
The following code is in init event of masterpage:
If Request.ServerVariables("http_user_agent").IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) <> -1 Then
Page.ClientTarget = "uplevel"
End If
This was necessary to get child menu's to show on other browsers as well. I tried:
page.clienttarget = "uplevel"
without the condition, but, this did not work.
I have also tried adding an android browser file, but, this did not work.
I have scoured the web for a few days. There a few similar questions, but, no answers. Has anyone had same problem? The menu works fine in ie, chrome, ff, safari, ipad, but, not on android mobile devices and not on android tablets.
There is no hover on an Android but my asp menu works if I hold down on the parent menu. Sadly I also get the browser menu when I hold down on it. You will have to design a menu that opens the child items with a single click. This cannot be done with the asp menu.
menus are not disappearing but the page is posting back..
just set navigateUrl property to 'javascript:return false'
I found a way to fix this.
Either do
document.body.setAttribute('onclick', 'setTimeout(function () { }, 0);');
in a startup script
or let the body tag look like this
<body onclick="setTimeout(function () { }, 0);">
Then it works on Android. I haven't tested on other iPhone or so.
(I have also tried some more conventional ways of adding this dummy script, but it did not work.)

Categories

Resources