Bug 24034 - Android Wear - Unable to implement WearableListView.Adapter
Summary: Android Wear - Unable to implement WearableListView.Adapter
Alias: None
Product: Android
Classification: Xamarin
Component: Pre-release ()
Version: 4.20.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jon Dick
Depends on:
Reported: 2014-10-24 03:12 UTC by David Poulin
Modified: 2014-12-19 16:40 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description David Poulin 2014-10-24 03:12:16 UTC

I was trying to create a simple wearable application with a simple basic WearableListView with its adapter, but WearableListView.Adapter cannot be implemented.

Steps to reproduce.

Create any simple adapter implementing WearableListView.Adapter;

Try to compile your projects.

Got two errors :

myproject\wear\HomeActivity_SimpleAdapter.java(8,8): Error:  myproject.wear.HomeActivity_SimpleAdapter is not abstract and does not override abstract method onBindViewHolder(android.support.wearable.view.WearableListView.ViewHolder,int) in android.support.v7.widget.RecyclerView.Adapter
public class HomeActivity_SimpleAdapter

myproject\wear\HomeActivity_SimpleAdapter.java(59,59): Error:  onCreateViewHolder(android.view.ViewGroup,int) in myproject.wear.HomeActivity_SimpleAdapter cannot override onCreateViewHolder(android.view.ViewGroup,int) in android.support.v7.widget.RecyclerView.Adapter; attempting to use incompatible return type
found   : android.support.v7.widget.RecyclerView.ViewHolder
required: android.support.wearable.view.WearableListView.ViewHolder
	public android.support.v7.widget.RecyclerView.ViewHolder onCreateViewHolder (android.view.ViewGroup p0, int p1)

Is it possible to get a workaround ou a bug fix ?

Thank you !

Comment 1 John Pilczak 2014-10-24 10:30:46 UTC
I was able to reproduce this bug by following the steps provided. I created a new application then attempted to create an implementation of WearableListView.Adapter. When attempting to override the methods for the WearableListView.Adapter implementation, I ran into the same build errors.

Gist of build error details: 

Environment Info:
=== Xamarin Studio ===

Version 5.7 (build 329)
Installation UUID: ea2dde6b-0915-4e87-bf59-0163cddeada5
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Apple Developer Tools ===

Xcode 6.1 (6539)
Build 6A1046a

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 959c1e4
Build date: 2014-10-03 00:25:37-0400

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/johnpilczak/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: (Starter Edition)

=== Build Information ===

Release ID: 507000329
Git revision: c5e64a09aca2e8dfbdf26e6f77d31cb79636d148
Build date: 2014-10-24 05:38:56-04

=== Operating System ===

Mac OS X 10.9.5
Darwin Vinces-xMac.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Jonathan Pryor 2014-10-24 17:32:15 UTC
@John: Please attach the project you created.
Comment 3 John Pilczak 2014-10-27 10:34:40 UTC
Link to the project: https://www.dropbox.com/s/5tf8sa51rb4navl/SimpleWear.zip?dl=0

It is basically a fresh project that adds the Xamarin Android Wearable NuGet package and then attempts to implement WearableListView.Adapter using the overrides offered by the intellisense.
Comment 4 John Pilczak 2014-10-29 12:14:57 UTC
It appears that the methods needed to implement a WearableListView are currently using the wrong type of ViewHolder. OnCreateViewHolder and OnBindViewHolder use RecyclerView.ViewHolder as their return type and parameter respectively right now as opposed to WearableListView.ViewHolder which is what is actually compatible with WearableListView causing the build errors.
Comment 5 David Poulin 2014-10-31 10:16:21 UTC

so any updates on that issue ? Are you planning a bug fix "soon" ? Is there a workaround ?

Comment 6 David Poulin 2014-11-17 08:46:51 UTC
Hi again,

Any updates ?
Comment 7 fwaris 2014-11-23 18:11:16 UTC
I am also running into the same issue. Eagerly awaiting a fix.
Comment 8 John Pilczak 2014-12-10 11:30:14 UTC
I was just informed of a workaround of this issue. If you implement a Android.Support.v7.RecyclerView.Adapter as opposed to a WearableListView.Adapter and then use that adapter the same way you would use the WearableListView.Adapter then it should work just fine on the newest version of the Wear package.
Comment 9 John Pilczak 2014-12-10 11:54:37 UTC
Sorry, I meant to say Android.Support.V7.Widget.RecyclerView.Adapter.
Comment 10 Jon Dick 2014-12-19 16:40:25 UTC
This is now released in 1.1.0.

You can use WearableListView.Adapter but the types that will be used are RecyclerView.ViewHolder (you can .JavaCast<WearableListView.Holder>() if you like, WearableListView.Holder is simply a subclass of RecyclerView.ViewHolder.