Usage analysis of button control and toast control in Android programming

This article describes the use of button control in Android programming with toast control. Share with you for your reference, as follows:

In the tutorial of this chapter, we will learn the use of button control and toast prompt control by the way.

In Android program development, the most user interaction control we use may be the button, and the most event we use is the onclick event.

These events are also the simplest events. We can call them through Google's own API interface. Let's see how to do it.

The first step. Create a new project EP. Toast. I use the default names for the activity and main view. Set the view activity_ main.xml:

Inside is a text label and a button control.

Step two. We write the core file mainactivity.java, where I will give you as many comments as possible:

Finally, we can see the effect.

Well, that's all for this chapter. Although these are basic things that can't be further basic. But no matter how large and complex the project is, it is actually built on these things. Knowledge accumulates only when it accumulates.

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>