当前位置:网站首页>Activity lifecycle
Activity lifecycle
2022-06-25 01:05:00 【I am at odds with 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); } }
边栏推荐
猜你喜欢

百公里加速仅5.92秒,威兰达高性能版以高能产品实力领跑

扎克伯格上手演示四款VR头显原型机,Meta透露元宇宙「家底」

Xcode preview displays a bug in the content of the list view and its solution

Single blind box removal, social blind box and friend blind box program source code

QT electronic clock

Kubernetes 架构核心组件工作原理解析

Custom control - round dot progress bar (imitating one key acceleration in security guard)

Text editor for QT project practice - Episode 10

ros(24):error: invalid initialization of reference of type ‘xx’ from expression of type ‘xx’

108 pages (40000 words) proposal for future apartment intelligent design platform project (version 2022)
随机推荐
2022安全员-C证考试模拟100题及在线模拟考试
Kubernetes 架构核心组件工作原理解析
Punch smart spirit 1. The brand is attractive. What is the strength of the product?
2021-09-12
Kibana installation via kubernetes visual interface (rancher)
ros(24):error: invalid initialization of reference of type ‘xx’ from expression of type ‘xx’
QT(35)-操作EXCEL-QXlsx-QAxObject
[redis realizes seckill service ④] one order for one person, and cannot be purchased repeatedly
用手机在同花顺上开户靠谱吗?这样炒股有没有什么安全隐患
丹麥技術大學首創將量子計算應用於能源系統潮流建模
2022r1 quick opening pressure vessel operation test questions and answers
Solution to network access packet loss of Tencent cloud international ECS
If the order has not been paid for 30 minutes, it will be automatically cancelled. How can I achieve this?
【Redis实现秒杀业务②】超卖问题的解决方案
热力图展示相关矩阵
ImageView展示网络图片
Input series
Activity startup process
A small crawler program written by beginners
QT(36)-rapidjson解析嵌套的json