@Override
        public void onAction(String name, boolean pressed, float tpf) {
            if (name.equals("wireframe") && !pressed) {
                wireframe = !wireframe;
                if (wireframe) {
                    terrain.setMaterial(matWire);
                } else {
                    terrain.setMaterial(matRock);
                }
            } else if (name.equals("triPlanar") && !pressed) {
                triPlanar = !triPlanar;
                if (triPlanar) {
                    matRock.setBoolean("useTriPlanarMapping", true);
                    // Planar textures don't use the mesh's texture coordinates but real-world coordinates,
                    // so we need to convert these texture-coordinate scales into real-world scales so it looks
                    // the same when we switch to tri-planar mode.
                    matRock.setFloat("Tex1Scale", 1f / (512f / grassScale));
                    matRock.setFloat("Tex2Scale", 1f / (512f / dirtScale));
                    matRock.setFloat("Tex3Scale", 1f / (512f / rockScale));
                } else {
                    matRock.setBoolean("useTriPlanarMapping", false);
                    matRock.setFloat("Tex1Scale", grassScale);
                    matRock.setFloat("Tex2Scale", dirtScale);
                    matRock.setFloat("Tex3Scale", rockScale);
                }
            }
        }
Demonstrates how to use terrain on Android.
The only difference is it uses a much smaller heightmap, so it won't use
all the device's memory.

@author bowens
jme3-examples/src/main/java/jme3test/terrain/TerrainTestAndroid.java