5 years ago (2015-04-01)  Software development |   First to comment  1 
post score 0 times, average 0.0
[Slideup] Catalog

As an Android APP, creating multiple activities is a must, just as windows software has multiple windows;

Android development to create multiple activities

In the establishment of multiple activities is particularly noteworthy: each activity must be registered in the manifest file AndroidManifest.xml.If you do not register the relevant activity in the AndroidManifest.xml manifest file, although sometimes the program can be compiled, but the application will use the software to call this activity, the app will appear "I'm sorry, the program has stopped running" for the android For beginners, this is a common cause of "programs have stopped running." Create multiple activities registered in AndroidManifest.xml as follows:

  Above is the three activities I created for the APP. They correspond to libiao.java, about.java, and bohao.java under the src folder. The layout files of the current activity are defined in these java files. Take bohao.java as an example, in this document public void onCreate(Bundle savedInstanceState) has the following piece of code:

This defines the layout of the bohao Activity as the bohao_layout under the layout folder.

How to start the activity

To start a new Activity, we can start by calling startActivity in the Context.like this:

 

This article has been printed on copyright and is protected by copyright laws. It must not be reproduced without permission.If you need to reprint, please contact the author or visit the copyright to obtain the authorization. If you feel that this article is useful to you, you can click the "Sponsoring Author" below to call the author!

Reprinted Note Source: Baiyuan's Blog>>https://wangbaiyuan.cn/en/android-development-to-establish-multiple-activity-2.html

Post comment

Style

No Comment

登录

Forget password?

您也可以使用第三方帐号快捷登录

切换登录

注册

TW