File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes button problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "button problem" Watch "button problem" New topic
Author

button problem

Alex Vandusen
Greenhorn

Joined: Jun 14, 2011
Posts: 13
I have a xml layout with three buttons and i assigned an activity to one of the buttons and it worked fine. When i went to do the second one i was confused about where in my class file i was suppose to add the code so i just made another one but it wouldnt work so my question is how do i assign those three button tasks in only one class file or do i do it a different way
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

you can use all three button in the same class. Suppose you have 3 buttons with 3 different id as



then you can use inner class as


Life is easy because we write the source code.....
Alex Vandusen
Greenhorn

Joined: Jun 14, 2011
Posts: 13
and how would i direct my three different buttons to three different xml layouts within that one class?
Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
You may want to create three different xml layouts for the three buttons...and did you see the startActivity() method ..... it will help...it would be like..


Edit :
Alex Vandusen wrote:... one class?

My mistake...i didnt see that one class..thing...i think you can use ... setContentView(YOUR XML LAYOUT ID) method....You can specify the XML LAYOUT ID according to button click....every xml layout should have the button layout on top of it...(Ofcourse button layout is another xml layout)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: button problem