my dog learned polymorphism*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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 liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1069
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: 41034
    
  43
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
 
Similar Threads
how to get phone number from my android app?
url error ,please help
how to get zim card number
Fetching contacts from phone book
hot to find network provide