

addNextIntentWithParentStack (clickIntentTemplate ). class ) PendingIntent clickPendingIntentTemplate = TaskStackBuilder. Add this code in onUpdate method in CollectionAppWidgetProvider class after tRemoteAdapter(R.id.widgetListView, intent) // template to handle the click listener for each item Intent clickIntentTemplate = new Intent (context, DetailsActivity. It requires some additional steps.įirst you need to setup a template for PendingIntent. Click events on ListView itemsĪdding click events on ListView items is not as simple as setting up the setOnItemClickListener on the ListView object. But as widgets run in a different context, we need to register the click event through a PendingIntent. The idea here is similar to how we add click events in our apps. public class MyWidgetRemoteViewsFactory implements RemoteViewsService. Create a new Java class, name it MyWidgetRemoteViewsFactory, and set it to implement the class RemoteViewsService.RemoteViewsFactory. An adapter is used to connect the collection items(for example, ListView items or GridView items) with the data set. Would appreciate if you guys could take a look at my code, and see whether i am doing something terribly catastrophic.RemoteViewsFactory serves the purpose of an adapter in the widget’s context. I made sure i was using the correct classed, but still can't get it to work. More frustrating is the fact that when i test the same views and layouts i am using, with android's native ListView, and dev-smart's HLV it actually works.

I have followed the example you've provided in the demo activity. Unfortunately though, I am suffering from one main problem - while i can scroll nice and smooth, i can't catch onItemClicked events. I have also tested the dev-smart's HorizontalListView, and i am getting much better results with your view. This software is distributed under Apache License 2.0: įirst of all, i want to thank you Alessandro for this lovely component. The minimum supported Android version is android 2.3 (API Level 9) License This is the styleable used for the HListView class: There are minor differences in the attributes supported like "hlv_dividerWidth" instead of the default "dividerHeight".

It supports almost all the features of the ListView widget. See the demo project for sample implementations Usage (gradle)Īdd this line to your dependency group: compile 'it.:hlistview:1.2.2' The library includes also an ExpandableHListView, also based on the official ExpandableListView. Based on the official ListView google code. Use RecyclerView instead Horizontal Variable ListView This widget is now deprecated and it won't be updated anymore.
