在的ListView RemoteViews [英] ListView in RemoteViews
问题描述
我需要一个ListView添加到远程视窗(在一个自定义通知,而不是一个小部件中使用)。
我的问题是,一旦我添加的ListView(或就此而言,任何视图)我不能访问它添加项目到它。
如果我试图通过提供一个自定义列表至极要解决它初始化它的使用静态佣工项目,我得到的运行时异常说,自定义视图类不能被发现。
什么是做到这一点的正确方法?
感谢
我需要一个ListView添加到远程视窗(在一个自定义通知,而不是一个小部件中使用)。
块引用>这是不可能的,原因有二。
首先,你不能把一个
的ListView
在RemoteViews
除了在蜂窝和更高的。第二,你不能从
通知接收用户输入的
RemoteViews
(例如,你不能使用按钮
在通知
,即使你可以在一个应用程序窗口小部件)。
什么是做到这一点的正确方法?
块引用>使用一个简单的
通知
,其中当用户点击它时,的PendingIntent
指向你的一个活动被调用。I need to add a ListView to a RemoteView (used in a custom notification, not a widget).
My problem is once I add the ListView (or for that matter, any view) I can't access it to add Items into it.
If I try to workaround it by providing a custom list wich initializes it's items using static helpers, I get runtime exception saying that the custom view class cannot be found.
What is the proper way to do this?
Thanks
解决方案I need to add a ListView to a RemoteView (used in a custom notification, not a widget).
That is not possible, for two reasons.
First, you cannot put a
ListView
in aRemoteViews
except on Honeycomb and higher.Second, you cannot receive user input from a
Notification
'sRemoteViews
(e.g., you cannot use aButton
in aNotification
, even though you can in an app widget).What is the proper way to do this?
Use a simple
Notification
, where when the user taps on it, aPendingIntent
pointing to an activity of yours is invoked.这篇关于在的ListView RemoteViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!