see
i have mainActivity which calls tempActivity
Now inside tempActivity i call some native method and malloc some data .. so now when user
1> come back from tempActivity to mainActivity or
2> exit from whole application
i need to call one clean up function which free all data malloc in native method so how can i implement such things?
Does android framework has any method to handle such clean up function?
Ok, i think the question is about how to free the memory that is being allocated using
malloc()inside native code.I had the same requirement in one of my Projects. I did it in the following way.
Inside
onStop()oronDestroy(), I did a native call, which I have used tofree()the allocated memory. This I think is the best and simplest way to do that. I am not sure if android is providing some API,s for this. It would be informatory to know if something like this exists. Thanks.