安卓的生命周期(初学)
来源:互联网 发布:mac日历广告如何禁止 编辑:程序博客网 时间:2024/06/17 08:25
package com.example.proj3;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class MainActivity extends Activity {
private final String TAG="Main";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv=new TextView(this);
tv.setText("おやすみなさい!");
setContentView(tv);
Log.i(TAG, "OnCreate Method is executed!");//安卓的日志
}
@Override
protected void onStart(){
super.onStart();
Log.i(TAG, "OnStart Method is executed!");//安卓的日志
}
@Override
protected void onRestart(){
super.onRestart();
Log.i(TAG, "OnRestart Method is executed!");//安卓的日志
}
@Override
protected void onResume(){
super.onResume();
Log.i(TAG, "OnResume Method is executed!");//安卓的日志
}
@Override
protected void onStop(){
super.onStop();
Log.i(TAG, "OnStop Method is executed!");//安卓的日志
}
@Override
protected void onPause(){
super.onPause();
Log.i(TAG, "OnPause Method is executed!");//安卓的日志
}
@Override
protected void onDestroy(){
super.onDestroy();
Log.i(TAG, "OnDestroy Method is executed!");//安卓的日志
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class MainActivity extends Activity {
private final String TAG="Main";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv=new TextView(this);
tv.setText("おやすみなさい!");
setContentView(tv);
Log.i(TAG, "OnCreate Method is executed!");//安卓的日志
}
@Override
protected void onStart(){
super.onStart();
Log.i(TAG, "OnStart Method is executed!");//安卓的日志
}
@Override
protected void onRestart(){
super.onRestart();
Log.i(TAG, "OnRestart Method is executed!");//安卓的日志
}
@Override
protected void onResume(){
super.onResume();
Log.i(TAG, "OnResume Method is executed!");//安卓的日志
}
@Override
protected void onStop(){
super.onStop();
Log.i(TAG, "OnStop Method is executed!");//安卓的日志
}
@Override
protected void onPause(){
super.onPause();
Log.i(TAG, "OnPause Method is executed!");//安卓的日志
}
@Override
protected void onDestroy(){
super.onDestroy();
Log.i(TAG, "OnDestroy Method is executed!");//安卓的日志
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
0 0
- 安卓的生命周期(初学)
- 初学安卓-----Fragment生命周期
- 安卓的生命周期?
- 安卓的生命周期
- 个人安卓学习----初学Activityの生命周期
- 安卓Activity的生命周期
- 安卓系统的生命周期
- 安卓Activity的生命周期
- 安卓活动的生命周期
- 安卓Activity的生命周期
- (菜鸟)初学安卓遇到的问题(模拟器连接)
- 献给初学安卓的自己。。Android
- 初学安卓所犯下的蠢事
- 安卓横竖屏切换的生命周期(重点)
- 安卓初学 关于安卓模拟器启动(双击启动应该是不正确的)
- 初学安卓开发 (1)
- 安卓初学笔记
- 初学安卓控件
- 51nod 1391 01串(模拟)
- BZOJ 1133 [POI2009]Kon DP
- A + B Problem II
- 白盒测试.
- Scrum
- 安卓的生命周期(初学)
- jaxp解析器 使用DOM对象来解析XML
- 第104讲:通过案例解析Akka中的Actor的不同类型的Constructor学习笔记
- Android关于JSON解析
- 接口与抽象类的区别
- Openstack网络之Vlan网络模式
- java.lang.RuntimeException: Parcel: unable to marshal value com.zhym.friendcircule.Photo@41fcd5c8
- 菜鸟的安卓实习之路----软键盘弹出布局不适不完全指南
- csdn能不能行啊,传个资源我都登陆过了,还是重复让登陆