如何在Android的阅读string.xml价值? [英] how to read value from string.xml in android?

查看:114
本文介绍了如何在Android的阅读string.xml价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了一行:

String Mess= R.string.mess_1 ;

得到的字符串值,而不是返回字符串,它给我整型的ID。任何人都可以指导我如何我可以得到它的字符串值?我提到的 string.xml 文件中的字符串值。

to get string value, but instead of returning string, it is giving me id of type integer. Can anyone guide me as to how I can get its string value? I mentioned the string value in the string.xml file.

任何帮助将是AP preciated。

Any help would be appreciated.

推荐答案

试试这个

String mess = getResources().getString(R.string.mess_1);

更多信息<一个href="http://developer.android.com/intl/de/guide/topics/resources/available-resources.html#stringresources">here

这篇关于如何在Android的阅读string.xml价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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