当前位置:网站首页>activity生命周期
activity生命周期
2022-06-24 20:17:00 【我与c语言不共戴天】
<?xml version="1.0" encoding="utf-8" ?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="xieting" android:onClick="tiaozhuang"/> </RelativeLayout> java package com.commerce.mylifeactivity; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); System.out.println("onCreate() xieting"); } @Override protected void onResume() { super.onResume(); System.out.println("onResume()xieting"); } @Override protected void onStop() { super.onStop(); System.out.println("onResume()xieting"); } @Override protected void onPause() { super.onPause(); System.out.println("onResume()xieting"); } public void tiaozhuang(View view) { Intent intent=new Intent(MainActivity.this,MainActivity2.class); startActivity(intent); finish(); } @Override protected void onDestroy() { super.onDestroy(); System.out.println("onResume()xieting"); } @Override protected void onStart() { super.onStart(); System.out.println("onResume()xieting"); } } xml2 <?xml version="1.0" encoding="utf-8" ?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity2"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="31" android:onClick="tiaozhuangdao"/> </RelativeLayout> java package com.commerce.mylifeactivity; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class MainActivity2 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); } public void tiaozhuangdao(View view) { Intent intent=new Intent(MainActivity2.this,MainActivity.class); startActivity(intent); } }
边栏推荐
- Unimportant tokens can be stopped in advance! NVIDIA proposes an efficient visual transformer network a-vit with adaptive token to improve the throughput of the model
- Scala adapter pattern
- Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar
- adb shell sendevent
- Leetcode 1248. Statistics of "graceful subarray" (harm, suddenly found that it can only enumerate violently)
- Use of JMeter
- 2022r1 quick opening pressure vessel operation test questions and answers
- EVM简略
- Punch smart spirit 1. The brand is attractive. What is the strength of the product?
- 108 pages (40000 words) proposal for future apartment intelligent design platform project (version 2022)
猜你喜欢

The basic principle and application of iterator and enhanced for

Activity startup process
![[microservices sentinel] sentinel quick start | building an image | starting the console](/img/88/a01c8120f6117f1b8e4463cf6f685f.png)
[microservices sentinel] sentinel quick start | building an image | starting the console

iNFTnews | 国内NFT发展仅限于数字藏品吗?

2021-09-12

Sliding window technology based on byte in transport layer

2022安全员-C证考试模拟100题及在线模拟考试

2022r1 quick opening pressure vessel operation test questions and answers

Technologie des fenêtres coulissantes en octets dans la couche de transmission

2022年全国最新消防设施操作员(高级消防设施操作员)模拟题及答案
随机推荐
打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
Text editor for QT project practice - Episode 10
2022 melting welding and thermal cutting recurrent training question bank simulated examination platform operation
Registration method of native method in JNI
Activity startup process
【微服务|Sentinel】实时监控|RT|吞吐量|并发数|QPS
Unimportant tokens can be stopped in advance! NVIDIA proposes an efficient visual transformer network a-vit with adaptive token to improve the throughput of the model
Jar package merging using Apache ant
最新QQ微信域名防红PHP程序源码+强制跳转打开
QT(35)-操作EXCEL-QXlsx-QAxObject
2022r1 quick opening pressure vessel operation test questions and answers
The drawableleft of the custom textview in kotlin is displayed in the center together with the text
Helm chart warehouse operation
Rich text tables, lists, pictures
Use of file class filenamefilter & filefilter in io
2022安全员-C证考试模拟100题及在线模拟考试
placeholder
2022 crane driver (limited to bridge crane) examination question bank simulated examination platform operation
Use of navigation and navigationui
Scala adapter pattern