surfaceView 来电问题 (急~~~~~~~~~~~~~)
使用serfaceView ,本来调用activity 的finish 后,系统会依次调用
onPuse()---->surfaceDestroy()--> onstop()--> onDestroy()
可是来电挂断电话后,退出游戏,调用activity 的finish后,会调用
onPause()--> surfaceDestroy() ,而不会调用onstop()--> onDestroy(),
为什么?????????????
本来每次来电,系统都会surfaceDestroy() ,然后surfaceCreated()--->surfaceChanged()
我的surfaceCreated里是启动线程new Thread(this).start();
每次来电都重新执行surfaceCreated,每次都会多启动一个线程,为了避免这种情况,
Thread thread = new Thread(this);
static boolean firstcreate = true;
public void surfaceCreated(SurfaceHolder holder) {
super.surfaceCreated(holder);
if(firstcreate){
thread.start();
firstcreate = false;
}else{
threadPause = false;
}
}
可是接听电话后,再退出游戏会出现上面的情况。为什么????????????????