skip to Main Content

I am trying to set String to the TextView. But response which I getting is like
<?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">"Fortune Life"</string>

So it takes full string from xml to string but I want only double quoted content.i.e.,"Fortune Life"
What to do to parse xml string?

2

Answers


  1. <?xml version="1.0" encoding="utf-8"?> 
    <string name="WebsiteTitle">"Fortune Life"</string>
    <string name="WebsiteURL">"http://tempuri.org/"</string>
    

    Then you can use string as R.string.WebsiteTitle or R.string.WebsiteURL.
    To use string in TextView use android:text = "@string/WebsiteTitle" or android:text = "@string/WebsiteURL"

    Login or Signup to reply.
  2. Well You Need to go to res > values > String.xml

    you need to set your String in String.xml

    enter image description here

    enter image description here

    In above image you need go to String xml

    <resources>
    <string name="app_name">DocumentRecord</string>
    <string name="your_title">your title</string>
    <string name="your_url"><a href="your_website"></a></string></resources>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search