当前位置:网站首页>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); } }
边栏推荐
猜你喜欢

Première application de l'informatique quantique à la modélisation des flux de puissance dans les systèmes énergétiques à l'Université technique danoise

Custom animation (simulated win10 loading animation)

【Redis实现秒杀业务④】一人一单,不可重复购买

Easy to wear - drop down radio

Using tcp/udp tools to debug the yeelight ribbon

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

2022R1快开门式压力容器操作考题及答案

Source code analysis the problem that fragments cannot be displayed in the custom ViewGroup

How to reduce the font size of custom controls (optimize the round dot progress bar)

2022熔化焊接与热切割复训题库模拟考试平台操作
随机推荐
图书馆管理系统代码源码(php+css+js+mysql) 完整的代码源码
The problem of multiple callback of video ads stimulated by applets (offcolse problem)
Preliminary understanding of qtoolbutton
Sanic service startup failed
2021-02-15
Practical operation notes - notebook plus memory and ash cleaning
Scala sample class case calculate
Scala sample class
Scala IO reads by lexical units and numbers
[micro service sentinel] real time monitoring | RT | throughput | concurrency | QPS
Default methods for Scala sample classes
ros(24):error: invalid initialization of reference of type ‘xx’ from expression of type ‘xx’
[microservices sentinel] cluster link | microservices cluster environment construction
Xcode预览(Preview)显示List视图内容的一个Bug及解决
The basic principle and application of iterator and enhanced for
Text border format and text block of rich text
Hot fix sophix multi-channel patch solution
QT electronic clock
activity生命周期
Solution to network access packet loss of Tencent cloud international ECS