Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » findViewById, member cannot be resolved
findViewById, member cannot be resolved [message #1245059] Thu, 13 February 2014 08:31
b lench is currently offline b lenchFriend
Messages: 1
Registered: February 2014
Junior Member
First post here - hope this is the appropriate forum for the following question:

I'm using the Java ADT and trying to add a button to a working example project.
The following line produces a "cannot be resolved" error because "toggleButton" is missing from

Button toggleButton = (Button) findViewById(;
(This seems to be declaring a new variable using a reference to itself.)

The editor offers to "create field 'toggleButton' in type id", but then warns that I'm modifying a "derived file", "R.Java".

How does one declare a variable this way?


FOLLOW UP (for future newbie):
The problem went-away after defining the button in the \res\layout\main.xml (see text below).
Apparently is derived from the XML resource, not from variable declarations in the "source" directory.
" <Button
android:text="Toggle Silent Mode"

[Updated on: Sun, 16 February 2014 18:50]

Report message to a moderator

Previous Topic:Remote Debugging Issue
Next Topic:ap file turn to gibberish
Goto Forum:

Current Time: Wed Nov 14 02:10:16 GMT 2018

Powered by FUDForum. Page generated in 0.01782 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top