请教,如何从onPause到onResumeDOC上有一个ACTIVITY的生命周期的图,,其中有从onPause到onResume
的状态改变,,如何才可以从onPause下一步直接触发onResume事件呢???请给代码:,帮忙啊,
的状态改变,,如何才可以从onPause下一步直接触发onResume事件呢???请给代码:,帮忙啊,
解决方案 »
- android部署到2.2报错和4.2不报错!
- android gps定位...报错了
- 请教webview 2.2真机下崩溃的原因
- 关于button的透明问题
- 求助android对话框如何指定其出现的位置?
- 很诡异,空指针异常
- 开始学android,但是没有java基础,有c#基础
- intent.getExtras() 为 null 的问题?
- 一个Json数组,怎么向Spinner中加入数据??只显示名字
- Android Studio中NDK开发C/C++代码无语法提示,无法debug或标红的问题。
- listview不处发onTouch事件,好像是要配一个什么属性?
- 刚初学安卓·好多书·不知道啥书好..
import android.app.AlertDialog;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;public class Index extends Activity { private static final String TAG = "IndexActivity"; @Override
protected void onStart() {
super.onStart();
Log.v(TAG, "protected void onStart()");
} @Override
protected void onPause() {
super.onPause();
Log.v(TAG, "protected void onPause()");
} @Override
protected void onResume() {
super.onResume();
Log.v(TAG, "protected void onResume()");
} @Override
protected void onStop() {
super.onStop();
Log.v(TAG, "protected void onStop()");
} @Override
protected void onDestroy() {
super.onDestroy();
Log.v(TAG, "protected void onDestroy()");
} @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.v(TAG, "public void onCreate"); Button button1 = (Button) this.findViewById(R.id.button1);
button1.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
new AlertDialog.Builder(Index.this).setTitle("标题").setMessage(
"简单消息框").setPositiveButton("确定", null).show();
}
}); }
}不触发onPause事件啊,怎么办,点击按钮也不行,
上面的代码就是弹出对话框,但还是不执行onPause事件,,
之后再按返回键 再调用的 onresume (注意一定要按返回键,如果你在弹出的对话框中有什么操作比如输入或单击一个button之类的话,这时还会调用onstop ,因为焦点已经转移到了对话框)