To detect that the button is clicked, you add an onClickListener(). You can think of the Android framework as having events that occur and a listener that listens for those events. The onCreate() method is used to define a Button and to specify an action to occur when the Button is clicked. The onCreate() method runs when MainActivity is created in the app. The generated code includes a method called onCreate(). MainActivity.java was generated with your project. The next step is to add code to MainActivity to detect when the button is clicked and to start SecondaryActivity. You have used Android Studio to create the foundation for a simple application in which MainActivity will start SecondaryActivity. You have learned about Intents and Activities.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |