to top
Android APIs
public class

RenderScript

extends Object
java.lang.Object
   ↳ android.renderscript.RenderScript

Class Overview

This class provides access to a RenderScript context, which controls RenderScript initialization, resource management, and teardown. An instance of the RenderScript class must be created before any other RS objects can be created.

Developer Guides

For more information about creating an application that uses RenderScript, read the RenderScript developer guide.

Summary

Nested Classes
enum RenderScript.ContextType ContextType specifies the specific type of context to be created. 
enum RenderScript.Priority RenderScript worker thread priority enumeration. 
class RenderScript.RSErrorHandler The runtime error handler base class. 
class RenderScript.RSMessageHandler The base class from which an application should derive in order to receive RS messages from scripts. 
Public Methods
void contextDump()
Print the currently available debugging information about the state of the RS context to the log.
static RenderScript create(Context ctx, RenderScript.ContextType ct)
Create a RenderScript context.
static RenderScript create(Context ctx)
Create a RenderScript context.
void destroy()
Destroys this RenderScript context.
void finish()
Wait for any pending asynchronous opeations (such as copies to a RS allocation or RS script executions) to complete.
final Context getApplicationContext()
Gets the application context associated with the RenderScript context.
RenderScript.RSErrorHandler getErrorHandler()
RenderScript.RSMessageHandler getMessageHandler()
void sendMessage(int id, int[] data)
Place a message into the message queue to be sent back to the message handler once all previous commands have been executed.
void setErrorHandler(RenderScript.RSErrorHandler msg)
void setMessageHandler(RenderScript.RSMessageHandler msg)
void setPriority(RenderScript.Priority p)
Change the priority of the worker threads for this context.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void contextDump ()

Added in API level 11

Print the currently available debugging information about the state of the RS context to the log.

public static RenderScript create (Context ctx, RenderScript.ContextType ct)

Added in API level 18

Create a RenderScript context.

Parameters
ctx The context.
ct The type of context to be created.
Returns
  • RenderScript

public static RenderScript create (Context ctx)

Added in API level 11

Create a RenderScript context.

Parameters
ctx The context.
Returns
  • RenderScript

public void destroy ()

Added in API level 11

Destroys this RenderScript context. Once this function is called, using this context or any objects belonging to this context is illegal.

public void finish ()

Added in API level 11

Wait for any pending asynchronous opeations (such as copies to a RS allocation or RS script executions) to complete.

public final Context getApplicationContext ()

Added in API level 11

Gets the application context associated with the RenderScript context.

Returns
  • The application context.

public RenderScript.RSErrorHandler getErrorHandler ()

Added in API level 11

public RenderScript.RSMessageHandler getMessageHandler ()

Added in API level 11

public void sendMessage (int id, int[] data)

Added in API level 18

Place a message into the message queue to be sent back to the message handler once all previous commands have been executed.

public void setErrorHandler (RenderScript.RSErrorHandler msg)

Added in API level 11

public void setMessageHandler (RenderScript.RSMessageHandler msg)

Added in API level 11

public void setPriority (RenderScript.Priority p)

Added in API level 11

Change the priority of the worker threads for this context.

Parameters
p New priority to be set.