Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android AsyncTask with native code

with the premise that I have NO EXPERIENCE of C language, I would like to solve a problem that does not allow me to proceed with the publication of my app.

I have a native function that uses ffmeg for file conversion, which I call from Android by AsyncTask.

I need to stop the native function, and tried in several ways:

1) I created a function "deleteRutine" in C which resets all the variables. (not working)

2) I added into function of converting a boolean variable, and I set it to false via a method from Android (not working)

What else can I try? Any advice?

like image 852
Giuseppe Avatar asked Dec 05 '25 15:12

Giuseppe


1 Answers

As mentioned by rui.araujo, the second method should work if implemented properly.

The boolean value you are passing from Android to a native function, print it and check whether it is getting passed properly or not. Mostly there might be a problem in your JNI method implementation because of which you code flag is not being modified.

Your code should be something like this:

while(FLAG==true)
{
     //Do Your task
}
return;

This should definitely work if implemented properly. I have used this in many similar situations.. If there is still some problem, edit your post and post the code snippet of the second implementation...

like image 153
Sandeep Avatar answered Dec 08 '25 08:12

Sandeep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!