得到一个TextView的文本在Android主窗口小部件(不活动)? [英] get text of a TextView in android home widget (not in activity)?

查看:166
本文介绍了得到一个TextView的文本在Android主窗口小部件(不活动)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始的Andr​​oid主控件编程,所以我可以通过settextviewtext(),但是当我想从它那里得到的文本,我没有理想,从我的窗口小部件提供商设置文本在家里部件一个TextView。不能使用findViewById(),为正常的,因为在活动,然后的getText()。有没有办法从部件供应商获得的TextView在家里部件的文字?或者告诉我如何从另一项活动得到?

I just begin programming with android home widget, so i could set text to a textview in home widget from my widget provider by settextviewtext() but when i want to get text from it, i have no ideal. Can not use findViewById() as normal as in activity and then getText(). Is there any way to get text of textview in home widget from widget provider? Or show me how to get from another activity?

推荐答案

CommonsWare 在<一个href="http://stackoverflow.com/questions/10969019/retrieve-text-from-textbox-in-android-widget/10969042#10969042">this问题说:

您不能。应用程序部件是只写:你可以把数据给他们,但   你不能阅读。

You can't. App widgets are write-only: you can push data to them, but you cannot read them.

相反,当你更新你的应用程序部件与新的文本,则需要   在一些地方保存文本,也许在一个文件中。

Instead, when you update your app widget with new text, you will need to store that text somewhere, perhaps in a file.

这篇关于得到一个TextView的文本在Android主窗口小部件(不活动)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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