Author Topic: Trouble adding Android UI on top  (Read 912 times)

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Trouble adding Android UI on top
« on: March 05, 2012, 09:54:41 pm »
Currently having trouble with adding Android UI on top. I can't seem to find a stable way to do this and support resuming.

I first had everything in the xml layout but going back to the previous activity and then forward again makes everything black every time.  It can do it by just minimising at rare times(does this in my game).
I believe its something to do with the GLSurfaceView needing to be recreated every time. Nothing online has really helped me - that I need Android 3.0+ or a custom GLSurfaceView.

I'm currently now doing this in code in the create method after I create the GLSurfaceView each time.

Code: [Select]
tvScore = new TextView(this);
tvScore.setText("-");
ll = new LinearLayout(this);
ll.addView(tvScore);
this.addContentView(ll, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

But I'm not sure if this is the right way to go.
There is no removeContentView, so I can't reuse the above controls for the new Activity. And I'm not sure if the old ones are being released. But I know that I need to keep adding them each time or my UI stuff will never show.


Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: Trouble adding Android UI on top
« Reply #1 on: March 06, 2012, 03:40:07 am »
Blah found my problem. Silly part on my side.

I wasn't setting this every time on create.
Code: [Select]
setContentView(R.layout.wwlayout);
Lots of wasted time on trying to fix crashes and black screen errors blah!