This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Android and the fly likes get button which is in another xml file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Android
Bookmark "get button which is in another xml file" Watch "get button which is in another xml file" New topic
Author

get button which is in another xml file

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1240
this is my main class.



i need to get the butting id which is not defined in R.layout.activity_main.xml file.Currently i am getting error for phone=(Button)findViewById(R.id.phone);.Because its definde in another xml file.can anyone help me.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
You can only get a reference to a GUI element that is part of a view that is inflated. It doesn't sound as if that would be the case in your code.

What do you propose to do with a reference to a GUI element that doesn't (yet) exist?
 
Have you checked out Aspose?
 
subject: get button which is in another xml file
 
It's not a secret anymore!