在的ListView RemoteViews [英] ListView in RemoteViews

查看:320
本文介绍了在的ListView 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 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.

这篇关于在的ListView RemoteViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆