<分区>
我刚开始使用 android 家庭小部件进行编程,因此我可以将文本设置为来 self 的小部件提供商的家庭小部件中的 TextView ,但是当我想从中获取文本时,我没有理想的选择。找不到 findById() 和 getText()。有没有办法从小部件提供商那里获取主窗口小部件中的 textview 文本?或者告诉我如何从另一项 Activity 中获益?
<分区>
我刚开始使用 android 家庭小部件进行编程,因此我可以将文本设置为来 self 的小部件提供商的家庭小部件中的 TextView ,但是当我想从中获取文本时,我没有理想的选择。找不到 findById() 和 getText()。有没有办法从小部件提供商那里获取主窗口小部件中的 textview 文本?或者告诉我如何从另一项 Activity 中获益?
最佳答案
她是示例代码。
TextView textValue = (TextView) layout.findViewById(R.id.labelValue);
String s = textValue.getText().toString();
textValue.setText("Welcome");
关于android - 在 Android 主页小部件中获取 TextView 的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11223362/
相关文章:
android - 使用 eclipse 将 youtube 视频嵌入到 android 应用程序中?
jquery - 使用关闭按钮扩展 jQuery UI Accordion - 绑定(bind)事件处理程序
android - 如何在 android 中显示 float 小部件(编辑文本和按钮)
java - JTextField getText() NullPointerException
android - 为什么 recyclerview 在第一次点击时不显示任何数据?
javascript - 如何在 Blogger 上嵌入第 3 方小部件