It seems there are two applications with similar architecture. In one, after the application is deployed, it appears in the onRestart () log; onResume (); in the other there is no .. minimized the application, the last thing I see in the onStope () log; and when I deploy it again - the black screen ... and again I turn it off - the log does not change. Why can this happen? in which cases the onRestart () methods are not called; onResume ()?
@Override public void run() { Canvas canvas; while(running){ canvas = null; try{ canvas= this.surfaceHolder.lockCanvas(null); if (canvas == null) continue; synchronized(surfaceHolder){ this.gamePanel.update(); this.gamePanel.onDraw(canvas); } } finally{ if(canvas!=null){ surfaceHolder.unlockCanvasAndPost(canvas); } } } } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { Log.d(TAG,"surfaceChanged"); } @Override public void surfaceCreated(SurfaceHolder holder) { Log.d(TAG,"surfaceCreated"); thread.setRunning(true); thread.start(); } @Override public void surfaceDestroyed(SurfaceHolder holder) { Log.d(TAG,"surfaceDestroyed"); //посылаем потоку команду на закрытие и дожидаемся, //пока поток не будет закрыт. boolean retry = true; thread.setRunning(false); // ну жна ли эта строка. без нее после сворачивания игры черный экран. while (retry) { try { thread.join(); retry = false; } catch (InterruptedException e) { // пытаемся снова остановить поток thread } } } 