Hello World

As always when introduced to a new framework,your first instinct should be to say “hello” to the world from a RenderScript script. To create a script, simply create a new file in your Android project and call it helloworld.rs. Listing 9–1 shows how we can create a simple function that will output the “Hello, World” string using a simple RenderScript debugging function.

Listing 9–1. “Hello, World” Script

#pragma version(1) #pragma rs java_package_name(com.apress.proandroid.ch9) void hello_world() {     rsDebug("Hello, World", 0); // 0 is because we cannot send only a string to the debug output... }

The first line declares which version of RenderScript your script uses. The second line declares the package name of the Java reflection ...

Get Pro Android Apps Performance Optimization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.