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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:54:54+00:00 2026-05-27T14:54:54+00:00

I am trying to find the original android source code, where the android:text attribute

  • 0

I am trying to find the original android source code, where the android:text attribute from the layout files is resolved to the actual string referred to via @string/ (for instance: android:text=”@string/hello”). The reason is the following: I have created a completely different way of setting up my layouts using a custom XML which in turn uses pre-written Widgets, an example:

<dialog name="Homepage">
  <field type="Combobox" label="Enter">
</dialog>

What I want to do: I want to be able to change the label attribute in my example to: label=”@string/enter” – so I can make use of the localization feature in android.

But in order to handle those @string commands, I need to know, where this is done in the original Android Source Code (on version 2.3 for instance) so I can imitate the behaviour. So far the only way I know of to obtain string resources is to use context.getString(int resID) – trouble is, how would I go about translating the String “@string/enter” to a res id? I assume I can’t, which is why i am curious about how android handles this.

I’d be really grateful if someone could point me in the right direction and I hope my explanation wasn’t too confusing 🙂 .

  • 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-27T14:54:54+00:00Added an answer on May 27, 2026 at 2:54 pm

    [..] trouble is, how would I go about translating the String “@string/enter” to a res id?

    You can use Resources.getIdentifier() for that.

    Small sample that gets the res id of @string/enter:

    Resources r = getResources();
    int resId = r.getIdentifier("enter", "string", getPackageName());
    

    Given that the format for resources is always the same, you can parse all three arguments out of this string and fill them into getIdentifier():

    @[<package_name>:]<resource_type>/<resource_name>
    

    from Accessing Resources

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

Sidebar

Related Questions

I'm trying to retrieve the original XML for a row as a string from
Trying to find a way to send a POST HTTPS request from Python to
I was trying to find something original and fun to do with artificial neural
I was trying to find the way for knowing if two files are the
I'm trying to find out the maximum texture size for the original Motorola Droid.
I'm trying to find a way to swipe images in my android application.I find
I'm trying to find the security code in this php for a mailer. Please
I'm trying to find a php function that will take a string and a
I'm working on some stuff related to converting files, and I'm trying to find
I am trying to find some samples of how to take a string and

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.