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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:59:55+00:00 2026-06-12T09:59:55+00:00

In my current project, I have three different EditText widgets, in three different Activity

  • 0

In my current project, I have three different EditText widgets, in three different Activity layouts, which are used to input a year. I started by creating the UI and originally had

<EditText android:id="@+id/year_text" ... other attributes ... />

in each of my XML layout files. I never had any compiler errors due to this name clash and only realized that it might be a problem as I started to implement the behavior behind the UI for each Activity. So my first question is whether or not this kind of name clash will lead to problems down the road?

From what I understand, the + tells the layout parser to create a new value for the named ID in the R.java file. I can also reference a previously given ID using the @id/name syntax. What happens if I remove the + from all of my EditTexts but one? This solves the problem of allocating a new value for the identifier in the R class. But will reusing the same ID inside different layouts cause any problems? (Recall that the name clashes are across different XML layout files, not within the same layout.)

For now, I have created long names for all of my widget IDs. For example:

<EditText android:id="@+id/details_year_text" ... other attributes ... />
<EditText android:id="@+id/year_filter_year_text" ... other attributes ... />
<EditText android:id="@+id/year_and_number_filter_year_text" ... other attributes ... />

The prefix follows the name of the XML layout file where each EditText lives. This gets a little bit cumbersome, especially when using the autocomplete feature in NetBeans. (Yes, I’m using NetBeans rather than Eclipse. =p). If I do in fact need to use unique names for each of my EditText widgets, it would be handy to separate them into namespaces. Does the XML layout support any syntax which will create inner classes of R.id which can serve as namespaces for my IDs?

Finally, I know this is a very small project. I can imagine there are Android apps with a lot more widgets than I am using. What is the standard practice, if any, for naming and organizing IDs in the XML layouts of a project?

  • 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-12T09:59:56+00:00Added an answer on June 12, 2026 at 9:59 am

    For your first question, android provides id tag for your resources xml file, which means you can declare your id first ( similar to string ), here is the information that might help you: http://developer.android.com/guide/topics/resources/more-resources.html#Id

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

Sidebar

Related Questions

I have never used something different than tomcat. For my current university project I
On my current project, which is a delivery system, I have a list of
In my current project I have a few different interfaces that require me to
I have three different MSI's created to deploy my project. My end result is
In my current project we have 5 different masterpages, there are some common elements
I have a requirement on my current project (a Flex app which will be
In our current project we have four different TFS2010 Team Projects in the same
In my current project, I have a lot of binary files of different formats.
I have three tables: Employee(EmployeeID,Fname,Lname...) ProjectHeader(ProjectID,LeadID,Status....) ProjectDetails(ProjectDetailsID,ProjectID....) Here's my current code: $get_projects = SELECT
For my current project I have to send a signature from PHP to Java

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.