首页 > 代码库 > Activity生命周期方法的调用顺序工程与测试日志
Activity生命周期方法的调用顺序工程与测试日志
下面为测试activity的方法的执行顺序 工程与测试资源地址
android工程
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.finalizetest" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.example.finalizetest.MainActivity" android:launchMode="singleTask" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.example.finalizetest.TabActivity"></activity> <activity android:name="com.example.finalizetest.Tab2Activity"></activity> </application> </manifest>
BaseActivity
/* * 创建日期:2012-9-19 */ package cn.com.fetion.activity; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.graphics.BitmapFactory; import android.graphics.drawable.Drawable; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.os.Handler; import android.text.TextUtils; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import cn.com.fetion.App; import cn.com.fetion.LogF; import cn.com.fetion.R; import cn.com.fetion.config.BehaviorTally; import cn.com.fetion.dialog.ToastF; import cn.com.fetion.logic.AVLogic; import cn.com.fetion.logic.AccountLogic; import cn.com.fetion.logic.MessageReceiverLogic; import cn.com.fetion.logic.ReceiverLogic; import cn.com.fetion.network.NetworkManager; import cn.com.fetion.service.FetionService; import cn.com.fetion.store.Config; import cn.com.fetion.test.performance.OffLineMonitorActivity; import cn.com.fetion.util.AndroidUtil; import cn.com.fetion.util.MemoryLog; import com.chinaMobile.MobileAgent; /** * 版权所有 中软国际有限公司。 保留所有权利。<br> * 项目名: 飞信 - Android客户端<br> * 描述: <br> * * @version 1.0 * @since JDK1.5 */ public class BaseActivity extends Activity { private final String fTag = "BaseActivity"; protected App mApp; private Context mContext; private BroadcastReceiver mReceiverBase; private IntentFilter mIntentFilter; private Map<String, List<ActionCallback>> mOnActions; private boolean mIsNoTitle; protected View mTitleBarView; protected View mTitleBarBackView; protected View mTitleViewLeft; protected ProgressBar netConnection; protected TextView mTitleTextView;// 修改为protected,子类中要访问 protected View mTitleViewRightDivider; protected LinearLayout mTitleViewRight; protected View mTitleViewLeftButton; private View mViewNetworkStatus; private ImageView LeftImageView; private TextView mTextViewNetworkStatus; private final int fNetworkStatusNetworkDisconnected = 1; private final int fNetworkStatusLoging = 2; private final int fNetworkStatusLoginSucceed = 3; private final int fNetworkStatusLoginFailed = 4; private int mNetworkStatus; private Runnable mRunnable; protected Handler mHandler; private NetworkStatusReceiver mReceiverNetworkStatus; private IntentFilter mIntentFilterNetworkStatus; // 用于接受 讨论组解散 或者 群解散 相关activity finish 的广播, private BroadcastReceiver mFinishBroadcastReceiver; // 转发消息的时候,关闭上一个会话的广播 private BroadcastReceiver mForwardFinishBroadcastReceiver; private IntentFilter mFinishIntentFilter; public static final String BACK_TO_NEW_GUIDE = "BACK_TO_NEW_GUIDE"; public static final String ACTION_NEED_LOGIN = "ACTION_NEED_LOGIN"; // 退出程序相应广播。 private BroadcastReceiver mExitReceiver; private View rightView; /** 界面上的网络状态标题栏小黄条 */ private final NetworkStatusTitleBar mNetworkStatusTitleBar = new NetworkStatusTitleBar(); public static final String CLOUD_RECORD_CONVERSATION = "cloud_conversation"; /** 当前有没有注册BaseReceiver广播 */ private boolean registerBaseReceiver = false; /** onPause里是否注销BaseReceiver 当执行onPause方法时 默认是会反注册掉mReceiverBase的 这会导致当联网请求时显示出对话框后如果该activity不被显示了该对话框会永远出现的问题 */ private boolean whetherUnregisterBaseReceiver = true; /** * 当执行onPause方法时 默认是会反注册掉mReceiverBase的 这会导致当联网请求时显示出对话框后如果该activity不被显示了该对话框会永远出现的问题 * * @return Returns the unregisterBaseReceiver. */ public boolean isWhetherUnregisterBaseReceiver() { return whetherUnregisterBaseReceiver; } /** * 当执行onPause方法时 默认是会反注册掉mReceiverBase的 这会导致当联网请求时显示出对话框后如果该activity不被显示了该对话框会永远出现的问题 * * @param unregisterBaseReceiver * The unregisterBaseReceiver to set. */ public void setWhetherUnregisterBaseReceiver(boolean unregisterBaseReceiver) { this.whetherUnregisterBaseReceiver = unregisterBaseReceiver; } /** * 注册讨论组解散广播 {@link ReceiverLogic#ACTION_DG_ACTIVITYS_FINISH} TODO 群解散未实现 * * @param target */ protected void registerFinishActivityReceiver(final String target) { LogF.d(fTag, "registerFinishActivityReceiver.target = " + target); if (TextUtils.isEmpty(target)) { return; } mFinishBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (ReceiverLogic.ACTION_DG_ACTIVITYS_FINISH.equals(action)) { String dgUri = intent.getStringExtra(ReceiverLogic.EXTRA_DG_URI); LogF.d(fTag, "registerFinishActivityReceiver.onReceive.target = " + target); LogF.d(fTag, "registerFinishActivityReceiver.onReceive.dgUri = " + dgUri); if (target.equals(dgUri)) { finish(); } } } }; mFinishIntentFilter = new IntentFilter(ReceiverLogic.ACTION_DG_ACTIVITYS_FINISH); registerReceiver(mFinishBroadcastReceiver, mFinishIntentFilter); } /** * 转发会话消息后,发送广播通知前一个会话,关闭之前的界面 */ protected void registerForwardFinishActivityReceiver() { mForwardFinishBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { finish(); } }; mFinishIntentFilter = new IntentFilter(ReceiverLogic.ACTION_FORWARD_ACTIVITYS_FINISH); registerReceiver(mForwardFinishBroadcastReceiver, mFinishIntentFilter); } @Override public void finish() { finishPre(); super.finish(); } private void finishPre() { if (mFinishBroadcastReceiver != null) { unregisterReceiver(mFinishBroadcastReceiver); mFinishBroadcastReceiver = null; } if (mForwardFinishBroadcastReceiver != null) { unregisterReceiver(mForwardFinishBroadcastReceiver); mForwardFinishBroadcastReceiver = null; } mApp.destroyActivity(this); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (MemoryLog.DEBUG_MEMORY) { MemoryLog.printMemory(getClass().getName() + "-->onCreate"); } LogF.d(fTag, "onCreate.intent = " + AndroidUtil.toString(getIntent())); mApp = (App) getApplication(); mContext = this; mOnActions = new HashMap<String, List<ActionCallback>>(); Config.setExitTime(this, -1);// 设置 registerExitReceiver(); } @Override public void setContentView(int layoutResId) { super.setContentView(R.layout.activity_base); getLayoutInflater().inflate(layoutResId, (ViewGroup) findViewById(R.id.linearlayout_base)); // 将子布局填充到父布局中 mTitleBarView = findViewById(R.id.layout_widget_title_bar); mTitleBarBackView = findViewById(R.id.title_main_layout); mTitleBarView.setVisibility(mIsNoTitle ? View.GONE : View.VISIBLE); if (!mIsNoTitle) { mTitleBarView.setVisibility(View.VISIBLE); mTitleViewLeft = findViewById(R.id.linearlayout_left); netConnection = (ProgressBar) findViewById(R.id.network_connection); mTitleViewLeftButton = findViewById(R.id.imageview_left); mTitleTextView = (TextView) findViewById(R.id.textview_title); mTitleViewRightDivider = findViewById(R.id.imageview_right_divider); mTitleViewRight = (LinearLayout) findViewById(R.id.linearlayout_right); mTitleViewLeft.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { onTitleBackPressed(); } }); mTitleViewLeft.setVisibility(View.VISIBLE); setTitle(getTitle()); } else { mTitleBarView.setVisibility(View.GONE); } mHandler = new Handler(); mIntentFilter = new IntentFilter(); mReceiverBase = new CommonReceiver(); if (isShowNetworkStatus()) { mIntentFilterNetworkStatus = new IntentFilter(); mReceiverNetworkStatus = new NetworkStatusReceiver(); mHandler = new Handler(); mIntentFilterNetworkStatus.addAction(ConnectivityManager.CONNECTIVITY_ACTION); if (!(this instanceof LoginActivity) && !(this instanceof RegisterActivity)) { mIntentFilterNetworkStatus.addAction(AccountLogic.ACTION_LOGIN_STATUS); } mViewNetworkStatus = findViewById(R.id.layout_dialog_popup_network_status); LeftImageView = (ImageView) mViewNetworkStatus.findViewById(R.id.imageview_tanhao_left); mViewNetworkStatus.setVisibility(View.GONE); mViewNetworkStatus.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { switch (mNetworkStatus) { case fNetworkStatusNetworkDisconnected: BehaviorTally.setTraceLog(BehaviorTally.NETWORK_DISCONNECTION_OCLICK); AndroidUtil.startActivitySettingWireless(mContext); break; case fNetworkStatusLoging: // sendAction(new Intent(AccountLogic.ACTION_CANCEL_LOGIN)); break; case fNetworkStatusLoginFailed: sendAction(new Intent(AccountLogic.ACTION_LOGIN_FOR_CACHE)); break; default: break; } BehaviorTally.setTraceLog(BehaviorTally.OFF_LINE_CLICK); } }); mTextViewNetworkStatus = (TextView) mViewNetworkStatus.findViewById(R.id.textview_network_status); registerReceiver(mReceiverNetworkStatus, mIntentFilterNetworkStatus); } } private boolean isShowNetworkStatus() { return this instanceof ConversationListActivity || this instanceof HomeNetworkListActivity; } private boolean isSendResumeAction() { return !(this instanceof LoginActivity || this instanceof RegisterActivity); } @Override public void setTitle(CharSequence title) { super.setTitle(title); if (!mIsNoTitle) { mTitleTextView.setText(title); } } public TextView getTitleTextView() { return mTitleTextView; } /** * 设置标题栏左边按钮图片 * * @param resid资源id */ protected void setTitleViewLeftButtonDrawable(int resid) { if (mTitleViewLeftButton instanceof ImageView) { ((ImageView) mTitleViewLeftButton).setImageResource(resid); } else { mTitleViewLeftButton.setBackgroundResource(resid); } } /** * 设置标题栏背景图 * * @param resid */ protected void setTitleBarBackground(int resid) { if (mTitleBarView != null) { mTitleBarView.setBackgroundResource(resid); } } public void setTitleDrawable(Drawable drawable) { if (!mIsNoTitle) { if (drawable != null) { drawable.setBounds(getResources().getDimensionPixelSize(R.dimen.friends_icon_paddingLeft), getResources().getDimensionPixelSize(R.dimen.friends_icon_paddingTop), getResources() .getDimensionPixelSize(R.dimen.friends_icon_paddingRight), getResources().getDimensionPixelSize(R.dimen.friends_icon_paddingBottom)); } mTitleTextView.setCompoundDrawablePadding(6); mTitleTextView.setCompoundDrawables(null, null, drawable, null); } } @Override public void setTitle(int titleId) { super.setTitle(titleId); setTitle(getText(titleId)); } @Override public void setTitleColor(int textColor) { super.setTitleColor(textColor); if (!mIsNoTitle) { mTitleTextView.setTextColor(textColor); } } /** * 设置窗口无标题栏(必须在super.onCreate(savedInstanceState);之前调用) * * @param enable */ protected void requestWindowNoTitle(boolean isNoTitle) { mIsNoTitle = isNoTitle; if (isNoTitle) { if (mTitleBarView != null) { mTitleBarView.setVisibility(View.GONE); } } else { if (mTitleBarView != null) { mTitleBarView.setVisibility(View.VISIBLE); } } } /** * 设置自定义标题栏 * * @param showRightDivider * @param rightViews */ protected void requestWindowTitle(boolean showRightDivider, View... rightViews) { if (!mIsNoTitle) { mTitleViewRightDivider.setVisibility(showRightDivider ? View.VISIBLE : View.INVISIBLE); if (rightViews != null) { mTitleViewRight.removeAllViews(); for (View view : rightViews) { if (null != view) { mTitleViewRight.addView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); if (rightViews.length == 1 && view instanceof ImageView) { LinearLayout.LayoutParams params = (android.widget.LinearLayout.LayoutParams) mTitleViewRight.getLayoutParams(); if (params.rightMargin != 0) { params.setMargins(params.leftMargin, params.topMargin, params.rightMargin, params.bottomMargin); } } } } rightView = mTitleViewRight.getChildAt(0); } } } public void setLeftTitleEnable(boolean enable) { mTitleViewLeft.setClickable(enable); mTitleViewLeft.setVisibility(enable ? View.VISIBLE : View.INVISIBLE); } /** * 设置自定义标题栏 * * @param view */ protected void setWindowTitleMiddle(View view) { if (!mIsNoTitle) { if (view != null) { LinearLayout layout = (LinearLayout) findViewById(R.id.linearlayout_middle); if (layout.indexOfChild(view) != -1) { layout.removeView(view); } layout.addView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); } } } @Override protected void onResume() { mApp.resumeActivity(this, isSendResumeAction()); if (!registerBaseReceiver) { registerReceiver(mReceiverBase, mIntentFilter); registerBaseReceiver = true; } MobileAgent.onResume(this); super.onResume(); if (MemoryLog.DEBUG_MEMORY) { MemoryLog.printMemory(getClass().getName() + "-->onResume"); } } @Override protected void onPause() { if (isWhetherUnregisterBaseReceiver() && registerBaseReceiver) { unregisterReceiver(mReceiverBase); registerBaseReceiver = false; } MobileAgent.onPause(this); super.onPause(); } @Override protected void onDestroy() { if (!isFinishing()) { finishPre(); } if (registerBaseReceiver) { unregisterReceiver(mReceiverBase); mReceiverBase = null; registerBaseReceiver = false; } if (mHandler != null && mRunnable != null) { mHandler.removeCallbacks(mRunnable); } mOnActions.clear(); if (mReceiverNetworkStatus != null) { unregisterReceiver(mReceiverNetworkStatus); mReceiverNetworkStatus = null; } if (mExitReceiver != null) { unregisterReceiver(mExitReceiver); mExitReceiver = null; } super.onDestroy(); if (MemoryLog.DEBUG_MEMORY) { MemoryLog.printMemory(getClass().getName() + "-->onDestroy"); } System.gc(); } protected void moveTaskToBack(Activity activity) { mApp.moveTaskToBack(this); } public void sendAction(Intent intent) { mApp.sendAction(intent); } public void sendAction(Intent intent, ActionCallback onAction) { String action = intent.getAction(); if (!mIntentFilter.hasAction(action)) {// 判断指定的 Action 是否存在 mIntentFilter.addAction(action);// 把Action添加的过滤器 registerReceiver(mReceiverBase, mIntentFilter); // 重新注册监听,无副作用; } if (!mOnActions.containsKey(action)) {// map集合 是否包含相应的key的值。 mOnActions.put(action, Collections.synchronizedList(new ArrayList<ActionCallback>())); } mOnActions.get(action).add(onAction); intent.putExtra(FetionService.EXTRA_ACTION_HASHCODE, onAction.hashCode()); mApp.sendAction(intent); } /** * 获取当前登录用户的userId * * @return 当前登录用户的userId */ public int getUserId(int defValue) { return mApp.getUserId(defValue); } /** * 版权所有 中软国际有限公司。 保留所有权利。<br> * 项目名:飞信 - Android客户端<br> * 描述:公共广播接收器<br> * * @version 1.0 * @since JDK1.5 */ private class CommonReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { LogF.d(fTag, "onReceive.intent = " + AndroidUtil.toString(intent)); String action = intent.getAction(); if (mOnActions != null && mOnActions.containsKey(action)) { int hashCode = intent.getIntExtra(FetionService.EXTRA_ACTION_HASHCODE, -1); intent.removeExtra(FetionService.EXTRA_ACTION_HASHCODE); List<ActionCallback> list = mOnActions.get(action); if (list != null) { int listIndex = -1; for (int i = 0; i < list.size(); i++) { if (hashCode == list.get(i).hashCode()) { listIndex = i; break; } } if (listIndex >= 0) { list.remove(listIndex).callback(intent); } else { // 说明UI层已经舍弃了老的action,或者logic层没有把回调的hashcode带回来 LogF.e(fTag, "action's hashcode not found, CommonReceiver.onReceive.mOnActions = " + mOnActions + ", intent = " + AndroidUtil.toString(intent)); } if (list.isEmpty()) { mOnActions.remove(action); } } } } } /** 登录成功后,网络发生变化时,小黄条状态提示 */ private class NetworkStatusReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { LogF.d(fTag, "NetworkStatusReceiver.onReceive.intent = " + AndroidUtil.toString(intent)); String action = intent.getAction(); if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) { // CONNECTIVITY_ACTION为StickyBroadcast类型的广播,注册即能收到通知 NetworkInfo networkInfo = (NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); boolean isConnected = false; if (networkInfo != null) { isConnected = networkInfo.isConnected(); } if (isConnected || AndroidUtil.isNetworkConnected(context)) { if (mRunnable != null) { mHandler.removeCallbacks(mRunnable); } AccountLogic.NETWORK_UNABLE = 0;// 网络状态变化 AndroidUtil.printLog("网络已连上"); mViewNetworkStatus.setVisibility(View.GONE); // mViewArrowRight.setVisibility(View.GONE); mTextViewNetworkStatus.setText(null); } else { offLineTest(context, "网络连接断开"); BehaviorTally.setTraceLog(BehaviorTally.NETWORK_DISCONNECTION_HINT); if (mRunnable == null) { mRunnable = new Runnable() { @Override public void run() { AndroidUtil.printLog("网络连接断开"); // 通知处理消息接收逻辑 sendAction(new Intent(MessageReceiverLogic.ACTION_MSGRECEIVER_NET_DISCONNECT)); // 通知会话列表,取消刷新等待 sendBroadcast(new Intent(MessageReceiverLogic.ACTION_CONVERSATIONLIST_UPDATE_NOTIFY)); AccountLogic.NETWORK_UNABLE = 1; mViewNetworkStatus.setVisibility(View.VISIBLE); mTextViewNetworkStatus.setText(R.string.hint_network_disconnected_setting); LeftImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.netstatus_tanhao)); // SZ 点击进入网络设置 mNetworkStatus = fNetworkStatusNetworkDisconnected; if (((BaseActivity.this) instanceof LoginActivity)) { LoginActivity lActivity = (LoginActivity) BaseActivity.this; lActivity.closeDialog(); } BehaviorTally.setTraceLog(BehaviorTally.OFF_LINE_HINT); } }; } mHandler.postDelayed(mRunnable, NetworkManager.TIMEOVER_SENSITIVITY); } } else if (AccountLogic.ACTION_LOGIN_STATUS.equals(action)) { // 登录状态,StickyBroadcast类型的广播 switch (intent.getIntExtra(AccountLogic.EXTRA_LOGIN_STATUS, -1)) { case AccountLogic.LOGIN_STATUS_LOGGING:// 正在登录中,显示连接中的提示, mViewNetworkStatus.setVisibility(View.GONE); netConnection.setVisibility(View.VISIBLE); LeftImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.netstatus_tanhao)); //mTextViewNetworkStatus.setText(R.string.hint_login_failed_relogin); mNetworkStatus = fNetworkStatusLoging; BehaviorTally.setTraceLog(BehaviorTally.OFF_LINE_HINT); break; case AccountLogic.LOGIN_STATUS_ONLINE:// 登录成功 AccountLogic.NETWORK_UNABLE = 0; mViewNetworkStatus.setVisibility(View.GONE); netConnection.setVisibility(View.GONE); mNetworkStatus = fNetworkStatusLoginSucceed; // 登陆成功remove延时广播,避免其他界面onCreate后再显示登陆成功的小黄条 BaseActivity.this.removeStickyBroadcast(intent); // 登陆成功,检查是否存在未读消息 sendAction(new Intent(MessageReceiverLogic.ACTION_ISEXIST_UNREADMSG_REQUEST)); break; case AccountLogic.LOGIN_STATUS_UNLOGIN:// 登录失败 offLineTest(context, "登录失败"); AccountLogic.NETWORK_UNABLE = 1; netConnection.setVisibility(View.GONE); mViewNetworkStatus.setVisibility(View.VISIBLE); mTextViewNetworkStatus.setText(R.string.hint_login_failed); mNetworkStatus = fNetworkStatusLoginFailed; LeftImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.netstatus_tanhao)); // SZ 断网提示,点击重新登录 BehaviorTally.setTraceLog(BehaviorTally.OFF_LINE_HINT); break; default: break; } } } } protected void onTitleBackPressed() { AndroidUtil.hideSoftInput(this, null); dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK)); dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK)); } public interface ActionCallback { public void callback(Intent intent); } protected void onTitlRightPressed() { rightView.performClick(); } protected void doException(int rspCode) { switch (rspCode) { case AVLogic.SC_400: showExceptionMessage(getString(R.string.notify_session_not_find)); break; case AVLogic.SC_401: showExceptionMessage(getString(R.string.notify_create_user_exception)); break; case AVLogic.SC_402: showExceptionMessage(getString(R.string.notify_data_format_exception)); break; case AVLogic.SC_404: showExceptionMessage(getString(R.string.notify_invalid_user)); break; default: showExceptionMessage(getString(R.string.notify_server_exception)); break; } } protected void showExceptionMessage(String message) { ToastF.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); } private void registerExitReceiver() { IntentFilter intentFilter = new IntentFilter("cn.com.fetion.toexit"); mExitReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { finish(); System.exit(-1); } }; registerReceiver(mExitReceiver, intentFilter); } protected NetworkStatusTitleBar getNetworkStatusTitleBar() { return mNetworkStatusTitleBar; } /** * 版权所有 中软国际有限公司。 保留所有权利。<br> * 项目名:飞信 - Android客户端<br> * 描述:界面上的网络状态标题栏小黄条 * * @author soul * @version 1.0 * @since JDK1.5 */ protected class NetworkStatusTitleBar { /** 是否初始化 */ private boolean init; /** * @return 使界面上的网络状态标题栏小黄条生效 想显示它须掉这个方法 */ private void init() { if (init) { return; } mViewNetworkStatus = findViewById(R.id.layout_dialog_popup_network_status); LeftImageView = (ImageView) mViewNetworkStatus.findViewById(R.id.imageview_tanhao_left); mViewNetworkStatus.setVisibility(View.GONE); mTextViewNetworkStatus = (TextView) mViewNetworkStatus.findViewById(R.id.textview_network_status); init = true; } /** * 在界面上显示网络状态标题栏小黄条 */ protected NetworkStatusTitleBar showNetworkStatusTitleBar() { init(); mViewNetworkStatus.setVisibility(View.VISIBLE); return this; } /** * 在界面上隐藏网络状态标题栏小黄条 */ protected NetworkStatusTitleBar hideNetworkStatusTitleBar() { if (init) { mViewNetworkStatus.setVisibility(View.GONE); } return this; } /** * 为网络状态标题栏小黄条设置标题文字 * * @param msg * 为nuLl则显示"" */ protected NetworkStatusTitleBar setShowMsg(String msg) { init(); msg = TextUtils.isEmpty(msg) ? "" : msg; mTextViewNetworkStatus.setText(msg); return this; } /** * @param resId * 为网络状态标题栏小黄条设置标题文字 */ protected NetworkStatusTitleBar setShowMsg(int resId) { init(); mTextViewNetworkStatus.setText(resId); return this; } /** * @return 获取网络状态标题栏小黄条顶层View */ protected View getNetworkStatusTitleBarLayout() { init(); return mViewNetworkStatus; } } /** * 掉线测试 * * @param context */ public void offLineTest(Context context, String reason) { if (Config.performanceTestEnable() && OffLineMonitorActivity.startTest == true && context.toString().contains("MoreActivity")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String currentTime = sdf.format(new Date()); Intent broadcastIntent = new Intent(); broadcastIntent.setAction("android.intent.action.offline"); broadcastIntent.putExtra("offlineReason", "掉线时间:" + currentTime + " " + "掉线原因:" + reason + "\r\n"); sendBroadcast(broadcastIntent); } } }
MainActivity
package com.example.finalizetest; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Canvas; import android.os.Bundle; import android.os.IInterface; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.WindowManager.LayoutParams; import android.widget.Toast; public class MainActivity extends BaseActivity { protected static final String TAG = "MainActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.tv).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { View iv1 = findViewById(R.id.iv1); View iv2=findViewById(R.id.iv2); String msg1="onClick() iv1' width:"+iv1.getWidth()+" height:"+iv1.getHeight()+" measuredWidth:"+iv1.getMeasuredWidth()+"measuredHeight:"+iv1.getMeasuredHeight(); String msg2="onClick() iv2' width:"+iv2.getWidth()+" height:"+iv2.getHeight()+" measuredWidth:"+iv2.getMeasuredWidth()+"measuredHeight:"+iv2.getMeasuredHeight(); i(msg1); i(msg2); Toast.makeText(getApplicationContext(), msg1+"\r\n"+msg2, 1).show(); startActivity(new Intent(MainActivity.this,TabActivity.class)); } }); } @Override public void onWindowAttributesChanged(LayoutParams params) { View iv1 = findViewById(R.id.iv1); View iv2=findViewById(R.id.iv2); String msg1="iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; String msg2="iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; if(iv1!=null){ msg1="iv1' width:"+iv1.getWidth()+" height:"+iv1.getHeight()+" measuredWidth:"+iv1.getMeasuredWidth()+"measuredHeight:"+iv1.getMeasuredHeight(); } if(iv2!=null){ msg2="iv2' width:"+iv2.getWidth()+" height:"+iv2.getHeight()+" measuredWidth:"+iv2.getMeasuredWidth()+"measuredHeight:"+iv2.getMeasuredHeight(); } i("onWindowAttributesChanged() "+msg1); i("onWindowAttributesChanged() "+msg2); super.onWindowAttributesChanged(params); } @Override public void onAttachedToWindow() { View iv1 = findViewById(R.id.iv1); View iv2=findViewById(R.id.iv2); String msg1="iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; String msg2="iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; if(iv1!=null){ msg1="iv1' width:"+iv1.getWidth()+" height:"+iv1.getHeight()+" measuredWidth:"+iv1.getMeasuredWidth()+"measuredHeight:"+iv1.getMeasuredHeight(); } if(iv2!=null){ msg2="iv2' width:"+iv2.getWidth()+" height:"+iv2.getHeight()+" measuredWidth:"+iv2.getMeasuredWidth()+"measuredHeight:"+iv2.getMeasuredHeight(); } i("onAttachedToWindow() "+msg1); i("onAttachedToWindow() "+msg2); super.onAttachedToWindow(); } @Override protected void onNewIntent(Intent intent) { View iv1 = findViewById(R.id.iv1); View iv2=findViewById(R.id.iv2); String msg1="iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; String msg2="iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; if(iv1!=null){ msg1="iv1' width:"+iv1.getWidth()+" height:"+iv1.getHeight()+" measuredWidth:"+iv1.getMeasuredWidth()+"measuredHeight:"+iv1.getMeasuredHeight(); } if(iv2!=null){ msg2="iv2' width:"+iv2.getWidth()+" height:"+iv2.getHeight()+" measuredWidth:"+iv2.getMeasuredWidth()+"measuredHeight:"+iv2.getMeasuredHeight(); } i("onNewIntent() intent:"+toString(intent)); i("onNewIntent() "+msg1); i("onNewIntent() "+msg2); super.onNewIntent(intent); } @Override public void onWindowFocusChanged(boolean hasFocus) { View iv1 = findViewById(R.id.iv1); View iv2=findViewById(R.id.iv2); String msg1="iv1' width:"+iv1.getWidth()+" height:"+iv1.getHeight()+" measuredWidth:"+iv1.getMeasuredWidth()+"measuredHeight:"+iv1.getMeasuredHeight(); String msg2="iv2' width:"+iv2.getWidth()+" height:"+iv2.getHeight()+" measuredWidth:"+iv2.getMeasuredWidth()+"measuredHeight:"+iv2.getMeasuredHeight(); i("onWindowFocusChanged() "+msg1); i("onWindowFocusChanged() "+msg2); super.onWindowFocusChanged(hasFocus); } @Override public CharSequence onCreateDescription() { View iv1 = findViewById(R.id.iv1); View iv2=findViewById(R.id.iv2); String msg1="iv1' width:"+iv1.getWidth()+" height:"+iv1.getHeight()+" measuredWidth:"+iv1.getMeasuredWidth()+"measuredHeight:"+iv1.getMeasuredHeight(); String msg2="iv2' width:"+iv2.getWidth()+" height:"+iv2.getHeight()+" measuredWidth:"+iv2.getMeasuredWidth()+"measuredHeight:"+iv2.getMeasuredHeight(); i("onCreateDescription() "+msg1); i("onCreateDescription() "+msg2); return super.onCreateDescription(); } @Override public void onContentChanged() { View iv1 = findViewById(R.id.iv1); View iv2=findViewById(R.id.iv2); String msg1="iv1' width:"+iv1.getWidth()+" height:"+iv1.getHeight()+" measuredWidth:"+iv1.getMeasuredWidth()+"measuredHeight:"+iv1.getMeasuredHeight(); String msg2="iv2' width:"+iv2.getWidth()+" height:"+iv2.getHeight()+" measuredWidth:"+iv2.getMeasuredWidth()+"measuredHeight:"+iv2.getMeasuredHeight(); i("onContentChanged() "+msg1); i("onContentChanged() "+msg2); super.onContentChanged(); } @Override public View onCreateView(String name, Context context, AttributeSet attrs) { Log.i(TAG, "在执行了"+i+"次后 onCreateView "+" name:"+name+" attrs className:"+attrs.getClass().getName()+" attrs:"+attrs); return super.onCreateView(name, context, attrs); } @Override public View onCreatePanelView(int featureId) { i("onCreatePanelView() featureId:"+featureId); return super.onCreatePanelView(featureId); } @Override public boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas) { View iv1 = findViewById(R.id.iv1); View iv2=findViewById(R.id.iv2); String msg1="iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; String msg2="iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; if(iv1!=null){ msg1="iv1' width:"+iv1.getWidth()+" height:"+iv1.getHeight()+" measuredWidth:"+iv1.getMeasuredWidth()+"measuredHeight:"+iv1.getMeasuredHeight(); } if(iv2!=null){ msg2="iv2' width:"+iv2.getWidth()+" height:"+iv2.getHeight()+" measuredWidth:"+iv2.getMeasuredWidth()+"measuredHeight:"+iv2.getMeasuredHeight(); } i("onCreateThumbnail() "+msg1); i("onCreateThumbnail() "+msg2); return super.onCreateThumbnail(outBitmap, canvas); } @Override public void onDetachedFromWindow() { View iv1 = findViewById(R.id.iv1); View iv2=findViewById(R.id.iv2); String msg1="iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; String msg2="iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0"; if(iv1!=null){ msg1="iv1' width:"+iv1.getWidth()+" height:"+iv1.getHeight()+" measuredWidth:"+iv1.getMeasuredWidth()+"measuredHeight:"+iv1.getMeasuredHeight(); } if(iv2!=null){ msg2="iv2' width:"+iv2.getWidth()+" height:"+iv2.getHeight()+" measuredWidth:"+iv2.getMeasuredWidth()+"measuredHeight:"+iv2.getMeasuredHeight(); } i("onDetachedFromWindow() "+msg1); i("onDetachedFromWindow() "+msg2); super.onDetachedFromWindow(); } }TabActivity
package com.example.finalizetest; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; public class TabActivity extends BaseActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tab); TextView tv= (TextView) findViewById(R.id.tv); tv.setText("tab"); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // startActivity(new Intent(TabActivity.this,Tab2Activity.class)); startActivity(new Intent(TabActivity.this,MainActivity.class)); } }); } }
Tab2Activity
package com.example.finalizetest; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; public class Tab2Activity extends BaseActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tab); TextView tv= (TextView) findViewById(R.id.tv); tv.setText("tab2"); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Tab2Activity.this,MainActivity.class)); } }); } }
程序运行Log日志
MainActivity 为 singleTask模式 当栈里有该activity对象启动该activity时会干掉栈里该对象上面的所有activity并执行该activity的onNewIntent方法而不是onCreate方法 其他Activity为普通模式 先启动MainActivity 在启动TabActivity在启动Tab2ACtivity在启动MainActivity在后退的Log日志 05-15 21:00:35.883: INFO/MainActivity(26620): 第1次执行 : onCreate() savedInstanceState:null 05-15 21:00:35.885: INFO/MainActivity(26620): 第2次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:00:35.896: INFO/MainActivity(26620): 第3次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:00:35.897: INFO/MainActivity(26620): 第4次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:00:35.897: INFO/MainActivity(26620): 第5次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:00:35.898: INFO/MainActivity(26620): 第6次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:00:35.899: INFO/MainActivity(26620): 第7次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:00:35.899: INFO/MainActivity(26620): 在执行了7次后 onCreateView name:LinearLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42778940 05-15 21:00:35.911: INFO/MainActivity(26620): 在执行了7次后 onCreateView name:ViewStub attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42778940 05-15 21:00:35.911: INFO/MainActivity(26620): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42778940 05-15 21:00:35.913: INFO/MainActivity(26620): 在执行了7次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42778940 05-15 21:00:35.917: INFO/MainActivity(26620): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42778940 05-15 21:00:35.925: INFO/MainActivity(26620): 第8次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:00:35.926: INFO/MainActivity(26620): 第9次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:00:35.927: INFO/MainActivity(26620): 在执行了9次后 onCreateView name:RelativeLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427adb00 05-15 21:00:35.929: INFO/MainActivity(26620): 在执行了9次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427adb00 05-15 21:00:35.932: INFO/MainActivity(26620): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427adb00 05-15 21:00:35.933: INFO/MainActivity(26620): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427adb00 05-15 21:00:35.941: INFO/MainActivity(26620): 第10次执行 : onContentChanged() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 21:00:35.942: INFO/MainActivity(26620): 第11次执行 : onContentChanged() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 21:00:35.942: INFO/MainActivity(26620): 第12次执行 : onStart() 05-15 21:00:35.942: INFO/MainActivity(26620): 第13次执行 : onResume() 05-15 21:00:35.962: INFO/MainActivity(26620): 第14次执行 : onAttachedToWindow() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 21:00:35.962: INFO/MainActivity(26620): 第15次执行 : onAttachedToWindow() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 21:00:36.192: INFO/MainActivity(26620): 第16次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 21:00:36.192: INFO/MainActivity(26620): 第17次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 21:00:36.192: VERBOSE/InputMethodManager(26620): onWindowFocus: null softInputMode=288 first=true flags=#1810100 05-15 21:00:36.192: VERBOSE/InputMethodManager(26620): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@427771f0 05-15 21:00:36.193: VERBOSE/InputMethodManager(26620): Starting input: tba=android.view.inputmethod.EditorInfo@427d9880 ic=null 05-15 21:00:36.193: VERBOSE/InputMethodManager(26620): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView@427771f0 ic=null tba=android.view.inputmethod.EditorInfo@427d9880 controlFlags=#104 05-15 21:00:36.202: VERBOSE/InputMethodManager(26620): Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@4276fd60 com.yulong.android.coolpadime/.CoolpadIME #519} 05-15 21:00:41.588: VERBOSE/Provider/Setting(26620): from settings cache , name = sound_effects_enabled value = http://www.mamicode.com/0>
进入MainActivity 点击返回 05-15 20:35:40.048: INFO/MainActivity(22895): 第1次执行 : onCreate() savedInstanceState:null 05-15 20:35:40.052: INFO/MainActivity(22895): 第2次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:35:40.055: INFO/MainActivity(22895): 第3次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:35:40.055: INFO/MainActivity(22895): 第4次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:35:40.055: INFO/MainActivity(22895): 第5次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:35:40.055: INFO/MainActivity(22895): 第6次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:35:40.057: INFO/MainActivity(22895): 第7次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:35:40.058: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:LinearLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@4275b2e8 05-15 20:35:40.059: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:ViewStub attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@4275b2e8 05-15 20:35:40.060: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@4275b2e8 05-15 20:35:40.070: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@4275b2e8 05-15 20:35:40.074: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@4275b2e8 05-15 20:35:40.077: INFO/MainActivity(22895): 第8次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:35:40.078: INFO/MainActivity(22895): 第9次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:35:40.078: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:RelativeLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42771fc0 05-15 20:35:40.079: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42771fc0 05-15 20:35:40.080: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42771fc0 05-15 20:35:40.086: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42771fc0 05-15 20:35:40.086: INFO/MainActivity(22895): 第10次执行 : onContentChanged() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:35:40.087: INFO/MainActivity(22895): 第11次执行 : onContentChanged() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:35:40.087: INFO/MainActivity(22895): 第12次执行 : onStart() 05-15 20:35:40.087: INFO/MainActivity(22895): 第13次执行 : onResume() 05-15 20:35:40.103: INFO/MainActivity(22895): 第14次执行 : onAttachedToWindow() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:35:40.106: INFO/MainActivity(22895): 第15次执行 : onAttachedToWindow() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:35:40.369: INFO/MainActivity(22895): 第16次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:35:40.369: INFO/MainActivity(22895): 第17次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:35:40.369: VERBOSE/InputMethodManager(22895): onWindowFocus: null softInputMode=288 first=true flags=#1810100 05-15 20:35:40.369: VERBOSE/InputMethodManager(22895): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@427a9ae8 05-15 20:35:40.370: VERBOSE/InputMethodManager(22895): Starting input: tba=android.view.inputmethod.EditorInfo@4279df90 ic=null 05-15 20:35:40.370: VERBOSE/InputMethodManager(22895): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView@427a9ae8 ic=null tba=android.view.inputmethod.EditorInfo@4279df90 controlFlags=#104 05-15 20:35:40.373: VERBOSE/InputMethodManager(22895): Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@427e5808 com.yulong.android.coolpadime/.CoolpadIME #441} 05-15 20:35:44.110: VERBOSE/ViewRootImpl(22895): Sending key event to IME: seq=58, event=KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BACK, scanCode=158, metaState=0, flags=0x8, repeatCount=0, eventTime=1042510775, downTime=1042510775, deviceId=2, source=0x101 }, this = ViewRoot{427a5558 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 9} 05-15 20:35:44.112: DEBUG/ViewRootImpl(22895): IME finishedEvent: seq = 58,handled = false,viewAncestor = ViewRoot{427a5558 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 9} 05-15 20:35:44.176: VERBOSE/ViewRootImpl(22895): Sending key event to IME: seq=59, event=KeyEvent { action=ACTION_UP, keyCode=KEYCODE_BACK, scanCode=158, metaState=0, flags=0x8, repeatCount=0, eventTime=1042510849, downTime=1042510775, deviceId=2, source=0x101 }, this = ViewRoot{427a5558 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 9} 05-15 20:35:44.178: DEBUG/ViewRootImpl(22895): IME finishedEvent: seq = 59,handled = false,viewAncestor = ViewRoot{427a5558 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 9} 05-15 20:35:44.179: INFO/MainActivity(22895): 第18次执行 : finish() 05-15 20:35:44.225: INFO/MainActivity(22895): 第19次执行 : onPause() 05-15 20:35:44.253: INFO/MainActivity(22895): 第20次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:35:44.254: INFO/MainActivity(22895): 第21次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:35:44.317: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 0) 05-15 20:35:45.061: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 1) 05-15 20:35:45.068: INFO/MainActivity(22895): 第22次执行 : onStop() 05-15 20:35:45.068: INFO/MainActivity(22895): 第23次执行 : onDestroy() 05-15 20:35:45.070: INFO/MainActivity(22895): 第24次执行 : onDetachedFromWindow() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:35:45.070: INFO/MainActivity(22895): 第25次执行 : onDetachedFromWindow() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:35:45.074: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 0)
进入MainActivity回到桌面回到MainActivity 返回 05-15 20:37:32.363: INFO/MainActivity(22895): 第1次执行 : onCreate() savedInstanceState:null 05-15 20:37:32.363: INFO/MainActivity(22895): 第2次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:37:32.363: INFO/MainActivity(22895): 第3次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:37:32.363: INFO/MainActivity(22895): 第4次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:37:32.363: INFO/MainActivity(22895): 第5次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:37:32.363: INFO/MainActivity(22895): 第6次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:37:32.363: INFO/MainActivity(22895): 第7次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:37:32.364: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:LinearLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42792958 05-15 20:37:32.364: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:ViewStub attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42792958 05-15 20:37:32.364: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42792958 05-15 20:37:32.365: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42792958 05-15 20:37:32.366: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@42792958 05-15 20:37:32.367: INFO/MainActivity(22895): 第8次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:37:32.367: INFO/MainActivity(22895): 第9次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:37:32.367: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:RelativeLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@4275b138 05-15 20:37:32.368: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@4275b138 05-15 20:37:32.369: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@4275b138 05-15 20:37:32.370: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@4275b138 05-15 20:37:32.371: INFO/MainActivity(22895): 第10次执行 : onContentChanged() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:37:32.371: INFO/MainActivity(22895): 第11次执行 : onContentChanged() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:37:32.371: INFO/MainActivity(22895): 第12次执行 : onStart() 05-15 20:37:32.371: INFO/MainActivity(22895): 第13次执行 : onResume() 05-15 20:37:32.397: INFO/MainActivity(22895): 第14次执行 : onAttachedToWindow() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:37:32.397: INFO/MainActivity(22895): 第15次执行 : onAttachedToWindow() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:37:32.617: INFO/MainActivity(22895): 第16次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:37:32.617: INFO/MainActivity(22895): 第17次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:37:32.617: VERBOSE/InputMethodManager(22895): onWindowFocus: null softInputMode=288 first=true flags=#1810100 05-15 20:37:32.617: VERBOSE/InputMethodManager(22895): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@42791a38 05-15 20:37:32.618: VERBOSE/InputMethodManager(22895): Starting input: tba=android.view.inputmethod.EditorInfo@427d8478 ic=null 05-15 20:37:32.618: VERBOSE/InputMethodManager(22895): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView@42791a38 ic=null tba=android.view.inputmethod.EditorInfo@427d8478 controlFlags=#104 05-15 20:37:32.622: VERBOSE/InputMethodManager(22895): Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@427e89a8 com.yulong.android.coolpadime/.CoolpadIME #445} 05-15 20:37:37.161: INFO/MainActivity(22895): 第18次执行 : onPause() 05-15 20:37:37.180: INFO/MainActivity(22895): 第19次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:37:37.183: INFO/MainActivity(22895): 第20次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:37:37.271: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 0) 05-15 20:37:37.294: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 1) 05-15 20:37:38.024: INFO/MainActivity(22895): 第21次执行 : onCreateDescription() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:37:38.024: INFO/MainActivity(22895): 第22次执行 : onCreateDescription() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:37:38.024: INFO/MainActivity(22895): 第23次执行 : onSaveInstanceState() outState:Bundle[{}] 05-15 20:37:38.024: INFO/MainActivity(22895): 第24次执行 : onStop() 05-15 20:37:43.308: INFO/MainActivity(22895): 第25次执行 : onRestart() 05-15 20:37:43.309: INFO/MainActivity(22895): 第26次执行 : onStart() 05-15 20:37:43.310: INFO/MainActivity(22895): 第27次执行 : onResume() 05-15 20:37:43.512: INFO/MainActivity(22895): 第28次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:37:43.512: INFO/MainActivity(22895): 第29次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:37:43.512: VERBOSE/InputMethodManager(22895): onWindowFocus: null softInputMode=288 first=true flags=#1810100 05-15 20:37:43.512: VERBOSE/InputMethodManager(22895): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@42791a38 05-15 20:37:43.512: VERBOSE/InputMethodManager(22895): Starting input: tba=android.view.inputmethod.EditorInfo@42803ae0 ic=null 05-15 20:37:43.512: VERBOSE/InputMethodManager(22895): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView@42791a38 ic=null tba=android.view.inputmethod.EditorInfo@42803ae0 controlFlags=#104 05-15 20:37:43.514: VERBOSE/InputMethodManager(22895): Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@42805000 com.yulong.android.coolpadime/.CoolpadIME #447} 05-15 20:38:05.711: VERBOSE/ViewRootImpl(22895): Sending key event to IME: seq=60, event=KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BACK, scanCode=158, metaState=0, flags=0x8, repeatCount=0, eventTime=1042652372, downTime=1042652372, deviceId=2, source=0x101 }, this = ViewRoot{427ee998 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 10} 05-15 20:38:05.713: DEBUG/ViewRootImpl(22895): IME finishedEvent: seq = 60,handled = false,viewAncestor = ViewRoot{427ee998 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 10} 05-15 20:38:05.715: VERBOSE/ViewRootImpl(22895): Sending key event to IME: seq=61, event=KeyEvent { action=ACTION_UP, keyCode=KEYCODE_BACK, scanCode=158, metaState=0, flags=0x8, repeatCount=0, eventTime=1042652382, downTime=1042652372, deviceId=2, source=0x101 }, this = ViewRoot{427ee998 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 10} 05-15 20:38:05.716: DEBUG/ViewRootImpl(22895): IME finishedEvent: seq = 61,handled = false,viewAncestor = ViewRoot{427ee998 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 10} 05-15 20:38:05.716: INFO/MainActivity(22895): 第30次执行 : finish() 05-15 20:38:05.755: INFO/MainActivity(22895): 第31次执行 : onPause() 05-15 20:38:05.781: INFO/MainActivity(22895): 第32次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:38:05.783: INFO/MainActivity(22895): 第33次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:38:05.943: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 0) 05-15 20:38:06.390: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 1) 05-15 20:38:06.398: INFO/MainActivity(22895): 第34次执行 : onStop() 05-15 20:38:06.398: INFO/MainActivity(22895): 第35次执行 : onDestroy() 05-15 20:38:06.400: INFO/MainActivity(22895): 第36次执行 : onDetachedFromWindow() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:38:06.400: INFO/MainActivity(22895): 第37次执行 : onDetachedFromWindow() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:38:06.401: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 0)
进入MainActivity锁屏 解锁 返回 05-15 20:40:30.883: INFO/MainActivity(22895): 第1次执行 : onCreate() savedInstanceState:null 05-15 20:40:30.888: INFO/MainActivity(22895): 第2次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:40:30.888: INFO/MainActivity(22895): 第3次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:40:30.888: INFO/MainActivity(22895): 第4次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:40:30.888: INFO/MainActivity(22895): 第5次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:40:30.889: INFO/MainActivity(22895): 第6次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:40:30.889: INFO/MainActivity(22895): 第7次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:40:30.889: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:LinearLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427725d0 05-15 20:40:30.890: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:ViewStub attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427725d0 05-15 20:40:30.890: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427725d0 05-15 20:40:30.897: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427725d0 05-15 20:40:30.898: INFO/MainActivity(22895): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427725d0 05-15 20:40:30.899: INFO/MainActivity(22895): 第8次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:40:30.899: INFO/MainActivity(22895): 第9次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 20:40:30.900: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:RelativeLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427a1fd0 05-15 20:40:30.901: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427a1fd0 05-15 20:40:30.902: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427a1fd0 05-15 20:40:30.903: INFO/MainActivity(22895): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427a1fd0 05-15 20:40:30.903: INFO/MainActivity(22895): 第10次执行 : onContentChanged() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:40:30.904: INFO/MainActivity(22895): 第11次执行 : onContentChanged() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:40:30.904: INFO/MainActivity(22895): 第12次执行 : onStart() 05-15 20:40:30.906: INFO/MainActivity(22895): 第13次执行 : onResume() 05-15 20:40:30.916: INFO/MainActivity(22895): 第14次执行 : onAttachedToWindow() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:40:30.916: INFO/MainActivity(22895): 第15次执行 : onAttachedToWindow() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 20:40:31.068: INFO/MainActivity(22895): 第16次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:40:31.068: INFO/MainActivity(22895): 第17次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:40:31.069: VERBOSE/InputMethodManager(22895): onWindowFocus: null softInputMode=288 first=true flags=#1810100 05-15 20:40:31.069: VERBOSE/InputMethodManager(22895): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@427af348 05-15 20:40:31.090: VERBOSE/InputMethodManager(22895): Starting input: tba=android.view.inputmethod.EditorInfo@427ee920 ic=null 05-15 20:40:31.090: VERBOSE/InputMethodManager(22895): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView@427af348 ic=null tba=android.view.inputmethod.EditorInfo@427ee920 controlFlags=#104 05-15 20:40:31.093: VERBOSE/InputMethodManager(22895): Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@42794bd0 com.yulong.android.coolpadime/.CoolpadIME #455} 05-15 20:40:36.772: INFO/MainActivity(22895): 第18次执行 : onPause() 05-15 20:40:36.788: INFO/MainActivity(22895): 第19次执行 : onCreateDescription() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:40:36.789: INFO/MainActivity(22895): 第20次执行 : onCreateDescription() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:40:36.789: INFO/MainActivity(22895): 第21次执行 : onSaveInstanceState() outState:Bundle[{}] 05-15 20:40:36.790: INFO/MainActivity(22895): 第22次执行 : onStop() 05-15 20:40:36.830: VERBOSE/InputMethodManager(22895): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@427af348 05-15 20:40:36.830: VERBOSE/InputMethodManager(22895): Starting input: tba=android.view.inputmethod.EditorInfo@427c14d8 ic=null 05-15 20:40:36.831: VERBOSE/InputMethodManager(22895): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView@427af348 ic=null tba=android.view.inputmethod.EditorInfo@427c14d8 controlFlags=#100 05-15 20:40:36.833: VERBOSE/InputMethodManager(22895): Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@427c7b18 com.yulong.android.coolpadime/.CoolpadIME #456} 05-15 20:40:36.833: WARN/IInputConnectionWrapper(22895): performPrivateCommand on inactive InputConnection 05-15 20:40:37.396: INFO/MainActivity(22895): 第23次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:40:37.396: INFO/MainActivity(22895): 第24次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:40:42.903: INFO/SurfaceTextureClient(22895): [STC::queueBuffer] (this:0x5240c880) fps:0.08, dur:11847.32, max:11847.32, min:11847.32 05-15 20:40:42.906: INFO/SurfaceTextureClient(22895): [STC::queueBuffer] this:0x5240c880, api:1, last queue time elapsed:11847.32 05-15 20:40:46.428: INFO/MainActivity(22895): 第25次执行 : onRestart() 05-15 20:40:46.429: INFO/MainActivity(22895): 第26次执行 : onStart() 05-15 20:40:46.473: INFO/MainActivity(22895): 第27次执行 : onResume() 05-15 20:40:46.518: INFO/MainActivity(22895): 第28次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 20:40:46.518: INFO/MainActivity(22895): 第29次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 20:40:46.519: VERBOSE/InputMethodManager(22895): onWindowFocus: null softInputMode=288 first=false flags=#1810100 05-15 20:40:46.520: VERBOSE/InputMethodManager(22895): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@427af348 05-15 20:40:46.520: VERBOSE/InputMethodManager(22895): Starting input: tba=android.view.inputmethod.EditorInfo@427a7358 ic=null 05-15 20:40:46.521: VERBOSE/InputMethodManager(22895): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView@427af348 ic=null tba=android.view.inputmethod.EditorInfo@427a7358 controlFlags=#100 05-15 20:40:46.536: VERBOSE/InputMethodManager(22895): Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@427e9b88 com.yulong.android.coolpadime/.CoolpadIME #457} 05-15 20:40:51.536: VERBOSE/ViewRootImpl(22895): Sending key event to IME: seq=96, event=KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_BACK, scanCode=158, metaState=0, flags=0x8, repeatCount=0, eventTime=1042818197, downTime=1042818197, deviceId=2, source=0x101 }, this = ViewRoot{4276e798 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 12} 05-15 20:40:51.537: DEBUG/ViewRootImpl(22895): IME finishedEvent: seq = 96,handled = false,viewAncestor = ViewRoot{4276e798 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 12} 05-15 20:40:51.609: VERBOSE/ViewRootImpl(22895): Sending key event to IME: seq=97, event=KeyEvent { action=ACTION_UP, keyCode=KEYCODE_BACK, scanCode=158, metaState=0, flags=0x8, repeatCount=0, eventTime=1042818282, downTime=1042818197, deviceId=2, source=0x101 }, this = ViewRoot{4276e798 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 12} 05-15 20:40:51.611: DEBUG/ViewRootImpl(22895): IME finishedEvent: seq = 97,handled = false,viewAncestor = ViewRoot{4276e798 com.example.finalizetest/com.example.finalizetest.MainActivity,ident = 12} 05-15 20:40:51.613: INFO/MainActivity(22895): 第30次执行 : finish() 05-15 20:40:51.658: INFO/MainActivity(22895): 第31次执行 : onPause()<pre name="code" class="plain"> MainActivity 为 singleTask模式 其他Activity为普通模式 先启动MainActivity 在启动TabActivity在启动MainActivity在后退的Log日志 05-15 21:07:43.968: DEBUG/dalvikvm(27612): Zygote::ForkAndSpecialize : 0 05-15 21:07:43.968: DEBUG/dalvikvm(27612): zygote get new systemTid : 27612 05-15 21:07:43.968: DEBUG/dalvikvm(27612): Late-enabling CheckJNI 05-15 21:07:43.973: DEBUG/dalvikvm(27612): threadid=2: interp stack at 0x4f3a2000 05-15 21:07:43.975: DEBUG/dalvikvm(27612): threadid=3: interp stack at 0x4f4aa000 05-15 21:07:43.975: DEBUG/dalvikvm(27612): Elevating priority from 0 to -8 05-15 21:07:43.977: DEBUG/jdwp(27612): prepping for JDWP over ADB 05-15 21:07:43.977: DEBUG/jdwp(27612): ADB transport startup 05-15 21:07:43.984: DEBUG/dalvikvm(27612): threadid=4: interp stack at 0x4f5b2000 05-15 21:07:43.985: DEBUG/jdwp(27612): JDWP: thread running 05-15 21:07:43.995: DEBUG/jdwp(27612): acceptConnection 05-15 21:07:43.995: DEBUG/jdwp(27612): trying to receive file descriptor from ADB 05-15 21:07:44.003: DEBUG/jdwp(27612): received file descriptor 44 from ADB 05-15 21:07:44.005: DEBUG/dalvikvm(27612): threadid=5: interp stack at 0x5159c000 05-15 21:07:44.005: DEBUG/dalvikvm(27612): zygote get thread init done 05-15 21:07:44.006: DEBUG/dalvikvm(27612): create interp thread : stack size=32KB 05-15 21:07:44.006: DEBUG/dalvikvm(27612): create new thread 05-15 21:07:44.006: DEBUG/dalvikvm(27612): new thread created 05-15 21:07:44.006: DEBUG/dalvikvm(27612): update thread list 05-15 21:07:44.007: DEBUG/dalvikvm(27612): threadid=6: interp stack at 0x515a4000 05-15 21:07:44.007: DEBUG/dalvikvm(27612): threadid=6: created from interp 05-15 21:07:44.007: DEBUG/dalvikvm(27612): start new thread 05-15 21:07:44.007: DEBUG/dalvikvm(27612): threadid=6: notify debugger 05-15 21:07:44.007: DEBUG/dalvikvm(27612): threadid=6 (ReferenceQueueDaemon): calling run() 05-15 21:07:44.007: DEBUG/jdwp(27612): processIncoming 05-15 21:07:44.007: DEBUG/dalvikvm(27612): create interp thread : stack size=32KB 05-15 21:07:44.008: DEBUG/dalvikvm(27612): create new thread 05-15 21:07:44.008: DEBUG/dalvikvm(27612): new thread created 05-15 21:07:44.008: DEBUG/dalvikvm(27612): update thread list 05-15 21:07:44.008: DEBUG/dalvikvm(27612): threadid=7: interp stack at 0x516ac000 05-15 21:07:44.008: DEBUG/dalvikvm(27612): threadid=7: created from interp 05-15 21:07:44.009: DEBUG/jdwp(27612): processIncoming 05-15 21:07:44.009: DEBUG/jdwp(27612): handlePacket : cmd=0x1, cmdSet=0xC7, len=0x13, id=0x4000024C, flags=0x0, dataLen=0x8 05-15 21:07:44.009: DEBUG/dalvikvm(27612): start new thread 05-15 21:07:44.009: DEBUG/dalvikvm(27612): threadid=7: notify debugger 05-15 21:07:44.009: DEBUG/dalvikvm(27612): threadid=7 (FinalizerDaemon): calling run() 05-15 21:07:44.009: DEBUG/dalvikvm(27612): create interp thread : stack size=32KB 05-15 21:07:44.009: DEBUG/dalvikvm(27612): create new thread 05-15 21:07:44.009: DEBUG/dalvikvm(27612): new thread created 05-15 21:07:44.009: DEBUG/dalvikvm(27612): update thread list 05-15 21:07:44.012: DEBUG/jdwp(27612): processIncoming 05-15 21:07:44.012: DEBUG/jdwp(27612): handlePacket : cmd=0x1, cmdSet=0xC7, len=0x17, id=0x4000024D, flags=0x0, dataLen=0xC 05-15 21:07:44.012: DEBUG/dalvikvm(27612): threadid=8: interp stack at 0x517b4000 05-15 21:07:44.012: DEBUG/dalvikvm(27612): threadid=8: created from interp 05-15 21:07:44.013: DEBUG/dalvikvm(27612): start new thread 05-15 21:07:44.013: DEBUG/Zygote(27612): fork pid : 0 05-15 21:07:44.013: DEBUG/dalvikvm(27612): threadid=8: notify debugger 05-15 21:07:44.013: DEBUG/dalvikvm(27612): threadid=8 (FinalizerWatchdogDaemon): calling run() 05-15 21:07:44.016: DEBUG/jdwp(27612): processIncoming 05-15 21:07:44.019: DEBUG/jdwp(27612): handlePacket : cmd=0x1, cmdSet=0xC7, len=0x13, id=0x4000024E, flags=0x0, dataLen=0x8 05-15 21:07:44.020: DEBUG/jdwp(27612): processIncoming 05-15 21:07:44.020: DEBUG/jdwp(27612): handlePacket : cmd=0x1, cmdSet=0xC7, len=0x13, id=0x4000024F, flags=0x0, dataLen=0x8 05-15 21:07:44.048: DEBUG/dalvikvm(27612): threadid=9: interp stack at 0x51bba000 05-15 21:07:44.049: DEBUG/dalvikvm(27612): threadid=10: interp stack at 0x51cc2000 05-15 21:07:44.061: DEBUG/jdwp(27612): sendBufferedRequest : len=0x39 05-15 21:07:44.179: ERROR/Trace(27612): error opening trace file: No such file or directory (2) 05-15 21:07:44.218: DEBUG/jdwp(27612): sendBufferedRequest : len=0x47 05-15 21:07:44.220: WARN/asset(27612): >>>>>>>>>>>>>>AssetManager begin to add defaultAssets 05-15 21:07:44.220: WARN/asset(27612): AssetManager-->kSystemAssets isok1 is sucess 05-15 21:07:44.220: WARN/asset(27612): AssetManager-->kCommonAssets isok2is sucess 05-15 21:07:44.220: WARN/asset(27612): AssetManager-->kMediatekAssets isok3 is sucess 05-15 21:07:44.221: WARN/asset(27612): >>>>>>>>>>>>>>AssetManager end to add defaultAssets 05-15 21:07:44.225: DEBUG/dalvikvm(27612): open_cached_dex_file : /data/app/com.example.finalizetest-2.apk /data/dalvik-cache/data@app@com.example.finalizetest-2.apk@classes.dex 05-15 21:07:44.254: INFO/MainActivity(27612): 第1次执行 : onCreate() savedInstanceState:null 05-15 21:07:44.264: INFO/MainActivity(27612): 第2次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:07:44.264: INFO/MainActivity(27612): 第3次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:07:44.264: INFO/MainActivity(27612): 第4次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:07:44.264: INFO/MainActivity(27612): 第5次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:07:44.264: INFO/MainActivity(27612): 第6次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:07:44.264: INFO/MainActivity(27612): 第7次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:07:44.266: INFO/MainActivity(27612): 在执行了7次后 onCreateView name:LinearLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427b14a8 05-15 21:07:44.268: INFO/MainActivity(27612): 在执行了7次后 onCreateView name:ViewStub attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427b14a8 05-15 21:07:44.269: INFO/MainActivity(27612): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427b14a8 05-15 21:07:44.271: DEBUG/skia(27612): Flag is not 10 05-15 21:07:44.273: INFO/MainActivity(27612): 在执行了7次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427b14a8 05-15 21:07:44.275: INFO/MainActivity(27612): 在执行了7次后 onCreateView name:FrameLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427b14a8 05-15 21:07:44.276: INFO/MainActivity(27612): 第8次执行 : onWindowAttributesChanged() iv1' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:07:44.277: INFO/MainActivity(27612): 第9次执行 : onWindowAttributesChanged() iv2' width:0 height:0 measuredWidth: 0 measuredHeight: 0 05-15 21:07:44.277: INFO/MainActivity(27612): 在执行了9次后 onCreateView name:RelativeLayout attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427b9408 05-15 21:07:44.278: INFO/MainActivity(27612): 在执行了9次后 onCreateView name:TextView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427b9408 05-15 21:07:44.279: INFO/MainActivity(27612): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427b9408 05-15 21:07:44.281: DEBUG/skia(27612): Flag is not 10 05-15 21:07:44.282: INFO/MainActivity(27612): 在执行了9次后 onCreateView name:ImageView attrs className:android.content.res.XmlBlock$Parser attrs:android.content.res.XmlBlock$Parser@427b9408 05-15 21:07:44.282: INFO/MainActivity(27612): 第10次执行 : onContentChanged() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 21:07:44.282: INFO/MainActivity(27612): 第11次执行 : onContentChanged() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 21:07:44.283: INFO/MainActivity(27612): 第12次执行 : onStart() 05-15 21:07:44.283: INFO/MainActivity(27612): 第13次执行 : onResume() 05-15 21:07:44.302: INFO/MainActivity(27612): 第14次执行 : onAttachedToWindow() iv1' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 21:07:44.302: INFO/MainActivity(27612): 第15次执行 : onAttachedToWindow() iv2' width:0 height:0 measuredWidth:0measuredHeight:0 05-15 21:07:44.346: DEBUG/libEGL(27612): loaded /vendor/lib/egl/libEGL_mtk.so 05-15 21:07:44.354: DEBUG/libEGL(27612): loaded /vendor/lib/egl/libGLESv1_CM_mtk.so 05-15 21:07:44.359: DEBUG/libEGL(27612): loaded /vendor/lib/egl/libGLESv2_mtk.so 05-15 21:07:44.393: DEBUG/OpenGLRenderer(27612): Enabling debug mode 0 05-15 21:07:44.395: INFO/MainActivity(27612): 第16次执行 : onWindowFocusChanged() iv1' width:72 height:72 measuredWidth:72measuredHeight:72 05-15 21:07:44.396: INFO/MainActivity(27612): 第17次执行 : onWindowFocusChanged() iv2' width:450 height:450 measuredWidth:450measuredHeight:450 05-15 21:07:44.396: VERBOSE/InputMethodManager(27612): onWindowFocus: null softInputMode=288 first=true flags=#1810100 05-15 21:07:44.396: VERBOSE/InputMethodManager(27612): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@427af6e0 05-15 21:07:44.396: VERBOSE/InputMethodManager(27612): Starting input: tba=android.view.inputmethod.EditorInfo@427c83b8 ic=null 05-15 21:07:44.396: VERBOSE/InputMethodManager(27612): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView@427af6e0 ic=null tba=android.view.inputmethod.EditorInfo@427c83b8 controlFlags=#104 05-15 21:07:44.400: VERBOSE/InputMethodManager(27612): Starting input: Bind result=InputBindResult{null com.yulong.android.coolpadime/.CoolpadIME #527} 05-15 21:07:44.462: VERBOSE/InputMethodManager(27612): Starting input: view=com.android.internal.policy.impl.PhoneWindow$DecorView@427af6e0 05-15 21:07:44.462: VERBOSE/InputMethodManager(27612): Starting input: tba=android.view.inputmethod.EditorInfo@427cab28 ic=null 05-15 21:08:06.545: VERBOSE/Provider/Setting(27612): invalidate [system]: current 1013 != cached 0 05-15 21:08:06.554: VERBOSE/Provider/Setting(27612): from db cache, name = sound_effects_enabled value = http://www.mamicode.com/0>
05-15 20:40:51.718: INFO/MainActivity(22895): 第32次执行 : onWindowFocusChanged() iv1‘ width:72 height:72 measuredWidth:72measuredHeight:7205-15 20:40:51.718: INFO/MainActivity(22895): 第33次执行 : onWindowFocusChanged() iv2‘ width:450 height:450 measuredWidth:450measuredHeight:45005-15 20:40:51.764: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 0)05-15 20:40:52.194: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 1)05-15 20:40:52.199: INFO/MainActivity(22895): 第34次执行 : onStop()05-15 20:40:52.199: INFO/MainActivity(22895): 第35次执行 : onDestroy()05-15 20:40:52.200: INFO/MainActivity(22895): 第36次执行 : onDetachedFromWindow() iv1‘ width:72 height:72 measuredWidth:72measuredHeight:7205-15 20:40:52.201: INFO/MainActivity(22895): 第37次执行 : onDetachedFromWindow() iv2‘ width:450 height:450 measuredWidth:450measuredHeight:45005-15 20:40:52.201: DEBUG/OpenGLRenderer(22895): Flushing caches (mode 0)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。