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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:54:39+00:00 2026-05-14T03:54:39+00:00

This page in the Android documentation defines an element id as follows: <TextView android:id=@+id/label

  • 0

This page in the Android documentation defines an element id as follows:

<TextView android:id="@+id/label" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" 
          android:text="Type here:" />

However this page defines it as:

<EditText id="text"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:textColor="@color/opaque_red"
    android:text="Hello, World!" />

I thought I had a decent understanding of what was going on until I saw this second example. In the first case, you need the + character so that id ‘label’ is added to the R file, correct? In the second case, would the EditText’s id not be added to the R file because it does not contain the + character?

Also, the second example does not include the android namespace on the id. Does having or not having the Android namespace affect whether that id will be added to the R file?

Thanks for any clarification.

  • 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-14T03:54:40+00:00Added an answer on May 14, 2026 at 3:54 am

    You are correct in your initial assessment. It’s worth noting that the second id tag

    <EditText id="text"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:textColor="@color/opaque_red"
        android:text="Hello, World!" />
    

    Is missing the android: namespace so it actually isn’t an android xml tag. The first one is an example of how to add that view’s id to the R file so you can access it in your code. To be honest, I’m not sure what the purpose of the id in the second example is*, but I know that android wouldn’t know what to do with it. The first one is the correct syntax.

    *This is just speculation, but I’m willing to bet it was a typo somebody didn’t notice or didn’t care to fix because they were trying to illustrate something else.

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

Sidebar

Related Questions

I was looking at this page: http://developer.android.com/guide/basics/what-is-android.html The section about Applicatiosn says that android
On this page of Android Development, -at step 6- they say : Instead of
Hi i have this in a html page android(2.1) webkit <SELECT id=my_id onclick=my_click(); >
Hi im new to both android and java i have php page in my
In the Avoid Creating Objects section of the page Designing for Performance in the
I've never developed for Android before, so please consider me 100% dumb when you
I developed a web application using phone gap framework for android platform. I only
I've taken some animation xml straight from the android docs, and as far as
I am wondering how to handle user input forms in my app. (real budget
Somehow I can't get my UTF-8 sources to play nice with Ant. I get

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.