how to gently exit android activity ?

160 views
Skip to first unread message

Louise Cypher

unread,
Dec 28, 2010, 6:20:15 AM12/28/10
to android-ndk
Hi

How to gently exit android activity ? (I know that i need to call Activity.finish())
but ... information about 'exit-or-no-exit' I have in GLSurfaceView.Renderer.onDrawFrame (in with I call my native stuff) with is obviously on other thread than the activity lives, so calling myActivity.finish from there is probably bad idea (leads to crash :))
I'm not a java land guy so plz help :]

Thanks!

--
Code it black!

Tim Mensch

unread,
Dec 28, 2010, 10:02:55 AM12/28/10
to andro...@googlegroups.com

Try something like this

m_activity.runOnUiThread(new Runnable()
{
public void run()
{
m_activity.finish();
}
});

Tim

Louise Cypher

unread,
Dec 28, 2010, 10:08:56 AM12/28/10
to andro...@googlegroups.com
ok, thanks, it turns out that i need to create Handler on Activity thread and pass it to renderer thread to be able to spawn Runnable, but it works now ;)


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.




--
--
Code it black!
Reply all
Reply to author
Forward
0 new messages