aspose file tools*
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: 1204
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
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
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?


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get button which is in another xml file