Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Ron McLeod
paul wheaton
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Himai Minh
Bartenders:
Forum:
Android
how to find view from fragment
john bean
Ranch Hand
Posts: 107
posted 1 year ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi how do you findview by id from a fragment could anyone tell me the following does not work
ImageButton simpleImageButton = (ImageButton) View.findViewById(R.id.off);
error
Non-static method 'findViewById(int)' cannot be referenced from a static context
thanks
john bean
Ranch Hand
Posts: 107
posted 1 year ago
Number of slices to send:
Optional 'thank-you' note:
Send
View rOff=view.findViewById(R.id.revoff);
rOff.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to convert a main activity to a fragment in a Tabbed actionbar
1 Error needs fix - cannot make a static reference to the non static method
Android: activity crashes when called.
Getting null pointer exception changing text in fragment programmatically
compile time errors
More...