0

I'm new to android programming and i would like to know if there's any way to use a button in the main.xml file or if i should just go ahead and make my screen with a custom ui from scratch in my main panel.

2 Answers 2

1

yes, you can, and find your button by:

Button btn = (Button) findViewById(R.id.button1);
Sign up to request clarification or add additional context in comments.

Comments

0

yes you can get a reference to the button object that the button in your layout xml represents. You can do whatever you want to it, including set listeners that will do things when it gets clicked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.