Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen onResume is called background goes blank
    primarykey
    data
    text
    <p>I have <code>Dialog</code> on transparent activity and it's like a pause menu, so when dialog is shown and I press <code>Home</code> button everything works fine but when I reopen it <code>Dialog</code> shows, except the background is blank. Game is made with <code>canvas</code> and <code>SurfaceView</code> so I can't display <code>Dialog</code> on that screen or can I, because I was trying but I get error every time</p> <p>So when I press back key <code>Dialog</code> shows perfectly:</p> <p><img src="https://i.stack.imgur.com/OHWrR.png" alt="enter image description here"></p> <p>But when I click Home button and that long click on Home button to reopen app I get this:</p> <p><img src="https://i.stack.imgur.com/mXesf.png" alt="enter image description here"></p> <p>onResume code:</p> <pre><code>@Override protected void onResume() { super.onResume(); ourSurfaceView.resume(); } public void resume() { isRunning = true; ourThread = new Thread(this); ourThread.start(); } </code></pre> <p>Activity which shows <code>Dialog</code>:</p> <pre><code>public class ShowPopUp extends Activity { Dialog myDialog; GameSurface ourSurfaceView; Button toMenu; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.showpopupmain); myDialog = new Dialog(ShowPopUp.this); myDialog.setContentView(R.layout.showpopup); myDialog.setTitle("Paused"); myDialog.setCancelable(true); Button button = (Button) myDialog.findViewById(R.id.Btn1); toMenu = (Button)myDialog.findViewById(R.id.Btn2); toMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); Intent menu = new Intent( "com.example.mygame.Menu"); startActivityForResult(menu, 5); } }); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { myDialog.dismiss(); finish(); } }); myDialog.show(); myDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { ShowPopUp.this.finish(); } }); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload