Possible to start a SurfaceView with a Game Thread anytime other than at startup of the program?

StackOverflow https://stackoverflow.com/questions/3432057

  •  26-09-2019
  •  | 
  •  

Question

I've read several example programs and tutorials to try and solve my problem but they all seem to go the same way. I've used a couple Activities and xml documents to create a menu that loads when my game starts. When the user clicks the "Start The Game" button, it loads a new Activity that sets the view with my game thread and all of the game properties. I know this activity works because I've run it alone as its own project, but every way I've tried to start it after the Menu, I get a nullPointerException and it force closes. I read the SurfaceViewOverlay tutorial and attempted to use that implementation, but I'm using a SurfaceView, not a GLSurfaceView. I'm debating rewriting my entire program to use OpenGL but I figured I would see if anyone else knows what I'm doing wrong here. If you need the code snippets I can paste some here, but it's not really the specific code that's wrong, I think it's the way I'm using(abusing) the language...

Thanks for any help, Aaron

Was it helpful?

Solution

All right I figured it out after looking around some more. I was doing something wrong with the FrameLayout, but it loads up fine now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top