how to get variable into string (string.xml using kotlin

239 Views Asked by At

Hi i'm new to programming so ...

I made a simple app and in MainActivity.kt I just have one textview that point to a string.

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/firsttext"

in string.xml I have lost of text that is just her for test\n\n does not make sence\n XXX and more text\n and in middle YYY ad some text

so far so good ,, it show text. I also have made a settingsFragment. In root_preferances.xml i have

<EditTextPreference
    android:defaultValue="not empty"
    android:key="edit_text_FrontPress"
    android:selectAllOnFocus="true"
    android:singleLine="true"
    android:title="Front pressure should be"
    app:useSimpleSummaryProvider="true" />

<EditTextPreference
    android:defaultValue="not empty"
    android:key="edit_text_RearPress"
    android:selectAllOnFocus="true"
    android:singleLine="true"
    android:title="Rear pressure should be"
    app:useSimpleSummaryProvider="true" />

Now here is my question ! do I get the value from settings menu edit_text_RearPress into the string.xml (on place where now XXX is show) edit_text_FrontPress into the string.xml (on place where now YYY is show)

so that is is visible in my text

0

There are 0 best solutions below