Resource ID 말고 실제의 string값을 얻기 위한 함수 getString(resId)
http://developer.android.com/intl/ko/guide/topics/resources/string-resource.html 참조
res/values/strings.xml
:<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello!</string>
</resources>
This layout XML applies a string to a View:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
This application code retrieves a string:
String string = getString
(R.string.hello);
You can use either getString(int)
or getText(int)
to retrieve a string. getText(int)
will retain any rich text styling applied to the string.
'안드로이드' 카테고리의 다른 글
안드로이드 applicationId 구하기 (0) | 2016.03.18 |
---|---|
Color Class 사용예 (0) | 2016.03.16 |
Error:Execution failed for task ':app:compileRetrolambdaDebug'. (0) | 2016.03.08 |
CheckBox 이미지 변경 (0) | 2016.02.18 |
package org.apache.http does not exist (0) | 2016.02.16 |