Reputation: 2164
Right now I have a native function which sort of does this:
Object o = new Object();
while (!o.done()) { o.compute(); }
return o.result();
This computing can take a while and I would want the UI in Android to be update with some kind of progress bar. So what I need is three different native functions, one for each step above. The problem I'm having is how to save the "native object" inbetween calls. Any tips?
Thanks
Upvotes: 0
Views: 441
Reputation: 8715
Your Android NDK C code statics act like statics do in normal application programming. As long as the current process (app) is running, your data will be preserved. If you have a method that will do a lot of processing, call it from a Java thread to work in the background like this:
new Thread(new Runnable()
{
public void run()
{
<call native method here>
}
}).start();
Upvotes: 2