当前位置:网站首页>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); } }
边栏推荐
- Add information on the left and add parts on the right of the status bar
- Text editor of QT project practice ---------- episode 8
- Registration method of native method in JNI
- Wallpaper applet wechat applet
- 打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
- [redis realizes seckill service ②] solution to oversold problem
- Jar package merging using Apache ant
- 通过kubernetes可视化界面(rancher)安装kibana
- [redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem
- 【Redis实现秒杀业务②】超卖问题的解决方案
猜你喜欢

If the order has not been paid for 30 minutes, it will be automatically cancelled. How can I achieve this?

Using tcp/udp tools to debug the yeelight ribbon

Custom animation (simulated win10 loading animation) - Optimization

Use of JMeter

51 single chip microcomputer multi computer communication

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

The basic principle and application of iterator and enhanced for

Usage of ViewModel and livedata in jetpack

Xcode预览(Preview)显示List视图内容的一个Bug及解决

QT(35)-操作EXCEL-QXlsx-QAxObject
随机推荐
傳輸層 以字節為單比特的滑動窗口技術
If the order has not been paid for 30 minutes, it will be automatically cancelled. How can I achieve this?
Sanic服务启动失败
QT(36)-rapidjson解析嵌套的json
Meta & Berkeley proposed a universal multi-scale visual transformer based on pooled self attention mechanism. The classification accuracy in Imagenet reached 88.8%! Open source
Introduction to smart contract security audit delegatecall (2)
Qiniu cloud uploads video to get the first frame of video
Sliding window technology based on byte in transport layer
【Redis实现秒杀业务④】一人一单,不可重复购买
Tiktok wallpaper applet v1.0.2 function, new arrival function
Text editor of QT project practice ---------- episode 11
Text editor for QT project practice - Episode 10
实现mnist手写数字识别
108页(4万字)未来公寓智能化设计平台项目方案建议书2022版
百公里加速仅5.92秒,威兰达高性能版以高能产品实力领跑
2022 crane driver (limited to bridge crane) examination question bank simulated examination platform operation
Text editor for QT project practice - Episode 12
I 刷题 I — 复制带随机指针的链表
Use of navigation and navigationui
The acceleration of 100 km is only 5.92 seconds, and the willanda high-performance version leads with the strength of high-energy products