2021-05-13 Android测试
Posted 今晚看星星
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2021-05-13 Android测试相关的知识,希望对你有一定的参考价值。
Activity由程序打开二创建,调用onCreate()方法, 当程序创建之后,开始运行,调用onStart()方法, 运行中,程序失去焦点,调用onPause()方法, 程序进入后台运行,调用onStop()方法,当程序重新获得焦点的时候,调用onResumn方法,程序被系统回收,调用onDestory()方法,结束生命
- 使用XML文件生命界面布局
- 在程序运行时动态添加, 修改界面布局
- LinearLayout 线性布局
- RelativeLayout 相对布局
- AbsoluteLayout 绝对布局
- FrameLayout 碎片布局
- TableLayout 表格布局
Intent intent = new Intent(MainActivity.this, SecondActivity.class);
intent.putExtra("name", "zhangsan");
startActivity(intent);
- 服务(Service) android中的四大控件,它能够长期在后台运行并不提供用户界面
即使用户切换到另一个应用程序,服务仍能够在后台运行
- 不要阻塞界面线程
- 不要在界面线程之外操作界面
- 打开文件,SharedPreferences share = getSharedPreferences(“my_file”, Context.MODE_PRIVATE);,文件不存在的时候,创建文件
- 获取Editor, SharedPreferences.Editor editor = share.edit();
- 编辑其中的数据,editor.putString(“account”, input_account.getText().toString());
- 提交修改,editor.commit();
以上是关于2021-05-13 Android测试的主要内容,如果未能解决你的问题,请参考以下文章
Android - 应用程序启动时片段 onCreate 崩溃
android jetpack 导航仪器测试在返回导航上失败