简体   繁体   中英

How to exchange data between renderscript and android framework?

I am new to renderscript. I am trying to add two array elements using renderscript.

I am able to pass the value to renderscript from Android by invoke_add method for coming back to Android framework from renderscript I was suggested to use rsSendToclient() .

How can I use rsSendToClient or any other way for coming back to android framework.

You have to use rsSendToClient(1, &data, sizeof(data)); in your script and decode the data in Java like this:

RSMessageHandler l_resHandler = new RSMessageHandler()
{
    @Override
    public void run()
    {
        switch (mID)
        {
            case 1:
            {
                // Handle mData 

            }
            break;
            default: super.run();
                break;
        }
    }

 };
 mRS.setMessageHandler(l_resHandler);

But I could not decode the value yet as I asked here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM