GUI example anyone?

Started by EgonOlsen, May 25, 2010, 10:02:17 PM

Previous topic - Next topic

EgonOlsen

I always fail when trying to create some gui components...may it be swing's or Android's. It's somehow not compatible with my way of thinking, i guess. I tried to open a simple dialog box after rendering some gl stuff....i just have no idea how. I can choose between some Looper.prepare()-blah exceptions, some called from wrong thread exceptions, array out of bounds and similar stuff. I know that raft has some gui elements in the bones demo, so it has to be possible. Does anybody has some simple example to get me started?

raft

source of Bones demo can be downloaded from download page, maybe it helps..

EgonOlsen

#2
Only in the way that i shows me that i'm actually doing it right...at least not totally wrong. I can happily open my dialog, but it has to happen inside the thread that created the Activity. That's the same one that is active when pressing a key or something. I think of it as some kind of event dispatch thread. However, onDrawFrame() of the renderer doesn't seem to run in this thread...but that's where i want to open the dialog. It's a benchmark and after running all the tests, the dialog with the results should open. But i have no onKeyUp or onCreateOptionsMenu...or whatever. I'm in onDrawFrame() knowing that i want to open my dialog...i just can't. When trying it, it tells me that i have to call Looper.prepare() before doing so. When calling this, it tells me that only the thread that created the Activity is allowed to fiddle around with the views. But i can't find anything to execute something in this thread. I also tried to create the dialog myself and somehow assign it to the Activity, but you can't do that. You can add views...but a dialog isn't a view!?

EgonOlsen

#3
Somehow got it working by sending a Broadcast from the onDrawFrame-method() that the Activity has a receiver for. If that is called, i'm in the right thread to open the dialog...but come on, that can't be right. I must be doing something really really stupid here...

raft


EgonOlsen

Splitted the topic into this and a thread for the benchmark.