0

I want to retrieve data from renderscript on ICS.

I send the data from the script using:

bool l_res = rsSendToClient(1,  &data, sizeof(data));
rsDebug("rsSendToClient:", (l_res?"Ok":"Error"));

I receive the data in java using:

RSMessageHandler l_resHandler = new RSMessageHandler()
{
        @Override
        public void run()
        {
            switch (mID)
            {
                case 1:
                {
                    // Handle mData 
                    ??
                }
                break;
                default: super.run();
                    break;
            }
        }

     };
     mRS.setMessageHandler(l_resHandler);

mData is an array of int.

How can I convert it to the required type ? For instance an array of double.

Fabien R
  • 685
  • 1
  • 8
  • 24

1 Answers1

0

This is not how you want to pass data between Java and Renderscript. You really should be creating an allocation of the appropriate type(s) and using that (i.e. an MxN allocation of double). Messages are meant to be short and simple (there are examples in the AOSP codebase that use messages to signal that a particular allocation has been filled in - take a look at frameworks/base/tests/RenderScriptTests/tests for source code).

Stephen Hines
  • 2,612
  • 1
  • 13
  • 12