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 8418507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:21:12+00:00 2026-06-10T02:21:12+00:00

I have the habit of using XML resources for everything… I mean, every single

  • 0

I have the habit of using XML resources for everything… I mean, every single numeric value, I put it in dimens.xml, for instance. But is this wise?

Example:

I have this layout for ad banners which I include in other layouts. The banner view has a minHeight associated of 50dp. This specific 50dp won’t be used anywhere else, it is only relevant for the banner minHeight. I might use 50dp somewhere else but in a completely different context. They are both 50dp but they have nothing in common besides the value itself.

My question is, should I put the banner 50dp in the dimens.xml and use the appropriate reference or should I just 50dp directly since I won’t be repeating this banner minHeight value anywhere?

Is there any kind of convention on this for Android projects?

  • 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-06-10T02:21:13+00:00Added an answer on June 10, 2026 at 2:21 am

    I think it is a great practice to use. In this case, you could probably get away with using the numerical value, but doing it the way you have, using the XML, creates situation where if you ever need to update your code, you only have to go to one spot. It may be one now, but if you ever grow your project, it might be 2, or 3 and so on. Like I said, I think it is a great practice and a great habit to be in; but, you don’t have to.

    It’s your call.

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

Sidebar

Related Questions

I'm coming from predominantly using VIM for everything, and so I have a habit
I have the habit (?!?!?) of returning everything as a const value. Like this...
So I've gotten in the habit of using WPF/C# value converters because they are
In JavaScript I have a habit of using the following fallback evaluation var width
For years, I've gotten in to the habit of not using the value of
I have a habit of using include() a lot in my php scripts. I
I have a bad habit of using the cursor keys of my keyboard to
I have this habit always a C++ project is compiled and the release is
I have a habit of hardcoding URLs into my HTML: ...<a href=www.mySite.com/login>logon to your
Some of the developers on the project I work on have a habit of

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.