Wednesday, April 6, 2011

Why Android R.java file can be in src/ or gen/ ?

Hi all,

When i started learning android i learned that R.java files goes to /gen folder

recently i saw it on /src file

( in WROX-Professional Android App Dev- sample code downloads ).

How does this work.

and also in some code i saw ( xml layout )

android:id="@+id/R.id.someName" ( i don't remember in which web page i saw this code , sorry ).

I don't understand this, can somebody help me with this.

Thanks in advance.

From stackoverflow
  • In older versions of Android (prior to 1.5), R.java was located in src/. It's not anymore it you should keep your's in gen/.

    About the id, this is a very easy to answer question et let me think you didn't bother to read Android tutorials. You have the answer here, step 5.

    Sumit M Asok : e-satis i have seen R.id.SomeNAme being used in XML like this -> android:id ="@+id/SomeName", but see how it is written in the above question. I couldn't find it in the page you linked me to. Sorry that i lost track of from which page i saw that piece of code, may be that code itself was wrong. Thanks for the answer.
    e-satis : It's exactly the same, in the first one you just have the complet path from the R class. Can't see why it bothers you.

0 comments:

Post a Comment