How to communicate with the activity from the renderer?

Problems with Canvas, OpenGL, etc...

How to communicate with the activity from the renderer?

Postby kenjinsakura » Wed Jun 23, 2010 9:56 am

Hi. I need to alter some layout components based on whats happening in my renderer. However, the program keeps stopping whenever I try to alter stuff by calling a method in my activity from my renderer. So apparently, the renderer runs on a separate thread, so that might have something to do with that. But I can't figure out how to sync or otherwise fix this problem.

So how are you supposed to communicate with the activity anyway?
kenjinsakura
Freshman
Freshman
 
Posts: 6
Joined: Fri Jun 04, 2010 5:27 am

Top

Re: How to communicate with the activity from the renderer?

Postby MichaelEGR » Wed Jun 23, 2010 12:29 pm

Check out Activity.postOnUiThread(Runnable)

Also you can also get to the Android event queue via "new android.os.Handler().<various post methods>"
Founder & Principal Architect; EGR Software LLC
http://www.typhonrt.org
http://www.egrsoftware.com
User avatar
MichaelEGR
Senior Developer
Senior Developer
 
Posts: 147
Joined: Thu Jan 21, 2010 5:30 am
Location: San Francisco, CA

Re: How to communicate with the activity from the renderer?

Postby kenjinsakura » Tue Jul 20, 2010 3:04 am

Thanks for that, it was actually Activity.runOnUiThread(Runnable) , but your post put me in the right direction. So I called that function from my GLSurfaceView and it worked.
kenjinsakura
Freshman
Freshman
 
Posts: 6
Joined: Fri Jun 04, 2010 5:27 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 1 guest