java - Activity instance changing per tick in JNI -


i have android lifecycle question can't find answered anywhere else.

(this not question making activity class global ref)

i'm using standard jni->native init() , tick() calls run game on native side. similar san angeles demo.

i pass both of these calls instance of java activity object. can call java in order (for example, turn adverts off, interact java twitter, etc).

q1 : when call tick() call native calls, create new thread, if so, why don't have call detachcurrentthread native side?

q2: i've tried caching activity instance on native init() function , storing in static. works on devices, on pre-android 5.0 device stale reference jni error when use instance in tick() function. making global 'reference' activity 'class' in onload() function sort this?

q3: when user closes interstitial adverts, callback on java side, pass native side (eg, restart music). create new native thread? cached activity instance still valid?

many thanks,

steve.

ok found own answers.

1.no. 2.yes, globalreference thing. 3.no, the java side a new thread.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -