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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:32:15+00:00 2026-06-01T23:32:15+00:00

Both work, obviously if you start concatenating you’ll need get string in order to

  • 0

Both work, obviously if you start concatenating you’ll need get string in order to avoid displaying an int.

Question: which is the most ‘elegant’ or ‘recommended’ to use?

Thank you

  • 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-01T23:32:16+00:00Added an answer on June 1, 2026 at 11:32 pm

    The second approach is more elegant, since internally, the TextView (or whatever View-class) will do the job of getting the String for your specified resource.

    Letting components do the internal work is always preferred. Also, it is shorter and more readable.


    About the internals I talked about: If you have a look at Androids source-code, you can see that the setText(int)-method of TextView is implemented like this:

    public final void setText(int resid) {
      setText(getContext().getResources().getText(resid));
    }
    

    So, it internally uses the Context-class to get the string from the resource-id. Now, if you look at the getText()-method (which also comes from the Context-class), you can see that it is implemented the same way:

    public final String getString(int resId) {
      return getResources().getString(resId);
    }
    

    So for performance or reliability reasons, it makes no difference. Still, it is shorter and more readable.

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

Sidebar

Related Questions

should i use Classname() or __construct() as constructor in CodeIgniter? both work, which should
I'm stuck deciding which to use as both seem to work. Should I be
I have a PHP based application that I need to work on both a
I'm writing a mobile marketing app, which is supposed to work on both iOS
These 2 ways of working both work, but I'm wondering if there's a difference
I plan on writing a Java 3D game that will work both on PC
Having problems with the combining of two statements in a controller. Both statements work
I currently work with both Visual Studio, Eclipse/Rad, and Vim heavily. Visual Studio and
why a usb drive can work in both linux os and windows os without
I've seen a couple of ways of doing theism they both seem to work

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.