从 AppWidgetProvider 中的 strings.xml 获取字符串
我在正常活动中有这个:
tv.setText(this.getString(R.string.week1));
我认为
remoteViews.setTextViewText(R.id.widget_textview,"something");
相当于
tv.setText("something");
How do I getString from strings.xml in AppWidgetProvider?
可能有一个非常简单的解决方案,但我尝试使用谷歌,我是 Android 新手......
I have this in a normal activity:
tv.setText(this.getString(R.string.week1));
I think
remoteViews.setTextViewText(R.id.widget_textview,"something");
is the equivalent to
tv.setText("something");
How do I getString from strings.xml in AppWidgetProvider?
There is probably a really easy solution but I tried using google and I'm new to android...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,当您获得 Context 时,您只需调用
onEnable()、onDisable()、onReceive() 和 onUpdate() 方法,默认情况下都会将上下文引用传递到其定义中。
希望这有帮助,
-serkan
So, when you get a hold of a Context you can just call
onEnable(), onDisable(), onReceive() and onUpdate() methods all pass context reference in to their definitions by default.
Hope this helps,
-serkan
我不知道如何“如何从 AppWidgetProvider 中的 strings.xml 获取字符串?”但我认为你尝试从 strings.xml 获取字符串
,可以这样做。
I do not know how to "How do I getString from strings.xml in AppWidgetProvider?" but I think you try to get string from strings.xml
and that could be done like this.