• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

R does not register id from xml

 
Giovanni Montano
Ranch Hand
Posts: 252
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear developers R does not register any id i write in xml, as result in main if I do findViewByID passing R.id the variable id i declare in xml is just not recognized, because is not written inside the R file
of course I press save to the html file but just R does not register.

Could you try if you can to import these few lines of code on your eclipse and see if it is working on your PC?

I tried everything, as clean, build,erase libraries, starting new projects, but nothing, so desperate i named the last one last... as symbol that really i do not know what I should do!
I even tried to update eclipse ADT Build: v22.6.2-1085508 but does not update maybe because is portable as is in the office)




and
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the name of the XML file, and where is it stored? You're missing EditText23, specifically?

the html file

Did you mean XML rather than HTML?

xmlns:android="http://schemas.android.com/ apk /res/android"

Are the spaces just a copy/paste mistake? As it is, it's incorrect.
 
Giovanni Montano
Ranch Hand
Posts: 252
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf, my deepest gratitude for your interest, I proceed to explain your questions hoping to find a way to continue soon to learn android.

Ulf Dittmer wrote:What is the name of the XML file, and where is it stored?


the XML file is named activity_main.xml and it is stored togheter with fragment_main.xml under the project path last/res/layout

Ulf Dittmer wrote:You're missing EditText23, specifically?


Ulf Dittmer wrote:the html file

Did you mean XML rather than HTML?
Yes I did a mistake, i definetely mean XML.



Ulf Dittmer wrote: xmlns:android="http://schemas.android.com/ apk /res/android"

Are the spaces just a copy/paste mistake? As it is, it's incorrect.
I am afraid the spaces are just a copy/paste mistake as you suggest as in the file i have

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

do you have some clue to help me? I try from eclipse to go to the "graphical layout" view and add the ID on the table view on the right part of the graphic editor, pressing enter after i put inside id a value it appear a gui saying:
update all references as well? this will update all XML references and Java R field references.
i press oK and just do not work.


i found another interesting track inside gen I had togheter with the R.java inside gen/com.example.last also another R.java inside the path android.support.v7.appcompact, so I found that other projects in eclipse that compiled well they had a class R with few public static final class varibles declared while the one I have it on default has houndreads of varible declared and automatically generated. As consequence i erased the directory, made a clean and build again.
All in all i think that the problem is due to the fact that the project that work give me small R files while the ones that do not work build this huge R files

hope the situation is clearer..
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you know it's not finding EditText23? The only place where that's used, the reference to it goes out of scope right away. Also, elaborate on what "just do not work" means.

That the R class of the v7 appcompat package is large is no surprise (the UI part of it is large), but that has no bearing on your R class (which should be pretty small).
 
Giovanni Montano
Ranch Hand
Posts: 252
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RESOLVED!!!
Ulf, i was really beginner( i mean I was, because also if I remain a newbe, I learned a lot from this case)
I modified everything giggling around with settings, also the place where I am coding is my office, so I installed a portable edition on a system that has a lot of permission access in the filesystem etc.
I tried to download a new portable ADT edition and I set the directory workspace on a place where i am sure i can access and the ADT version is even newer..
as result is working now what I save in xml is immediately registered in R.

I want to say thank you for the time you spend on that and for all the useful tips that gave me the possibility to know better how an android project is structured.
the system is ready and so do I to become an android programmer

Ulf Dittmer wrote:How do you know it's not finding EditText23? The only place where that's used, the reference to it goes out of scope right away. Also, elaborate on what "just do not work" means.

That the R class of the v7 appcompat package is large is no surprise (the UI part of it is large), but that has no bearing on your R class (which should be pretty small).


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic