Summary of creation steps of activity jump in Android

1、 Create project

File - > New - > Android application fill in the application name, project name and package name in turn. Find Src / com.example.helloworld mainactivity.java in the project directory

2、 Add code

Before adding code, you should first enter RES / layout / activity_ In main.xml, drag and drop a button control. The activity is automatically displayed in the_ Generate button information in main.xml. Pay attention to the ID value. It is useful if you use this button

3、 Add jump activity

1. Right click Src / com.example.helloworld, new - > class, and fill in intentactivity in the name field without adding Java. 2. Add layout. Right click RES / layout, new - > Android XML file, and drag a textview onto the XML. At this time, the address of textview is automatically added in r.java. 3. Add the following code in androidmanifest.xml: complete the registration of activity

3、 Implement intentactivity.java

4、 Run

Open the simulator or mobile phone and run it.

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
分享
二维码
< <上一篇
下一篇>>