Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 769423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:19:58+00:00 2026-05-14T18:19:58+00:00

I usually place my keys on an xml and access them with R.string.key_name but

  • 0

I usually place my keys on an xml and access them with R.string.key_name but someone make me notice that I could have inline strings in the code.

I feel that I might use that key in different places and if I change its name I would just rename in the xml but perhaps that doesn’t make too much sense with keys.

What do you think?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:19:59+00:00Added an answer on May 14, 2026 at 6:19 pm

    Your question conflates two different questions:

    1. Does it make sense to have a single definition of your key?
    2. Does it make sense for this single definition to be within an XML file?

    The answer to point 1 is clearly “yes”. Duplicating strings used as keys (which need to be the same everywhere for your code to function correctly) is a recipe for pain and heartache.

    But what benefit does putting the key in an XML file give you? You’re just adding “noise” to your code, and ensuring that whoever reads it has to find, understand and look in at least one additional file.

    public static final is the way to go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read that it is bad practice, but usually harmless , to place most
I have read in a lot of places that assembly language is not usually
Usually, I try to set my folders to have permission 775, but some web-hosting
Why are JS scripts usually place in the header of a document? Is it
Usually I come across situations where I have to swallow an exception thrown by
Usually I was doing something like that (just a example): using (Stream xmlStream =
In this question I was having problem with saving objects that had foreign keys
I usually don't post questions on these forums, but I've searched all over the
I usually store dimensions in dimen.xml file. However, IntelliJ IDEA's intellisense places dimensions into
I've got an aspx page that inherits from a master page template. Usually, I'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.