我需要一个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 a RemoteViews
except on Honeycomb and higher.
Second, you cannot receive user input from a Notification
's RemoteViews
(e.g., you cannot use a Button
in a Notification
, 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, a PendingIntent
pointing to an activity of yours is invoked.