Troubleshooting guide
51
2: Using graphics and multimedia
System.out.println(“Error occurred during drawing: “ + e);
}
if(restored.equals(original)) {
System.out.println(“Success! Bitmap renders correctly with RGB data.”);
} else if(!restored.equals(original)) {
System.out.println(“Bitmap rendered incorrectly with RGB data.”);
}
BitmapField field1 = new BitmapField(original, BitmapField.STAMP_MONOCHROME);
BitmapField field2 = new BitmapField(restored);
add(new LabelField(“Original bitmap: “));
add(field1);
add(new LabelField(“Restored bitmap: “));
add(field2);
}
}
Using audio
Start the media player from the BlackBerry Browser
1. Invoke Browser.getDefaultSession().
BrowserSession soundclip = Browser.getDefaultSession();
2. Invoke BrowserSession.displaypage().
soundclip.displayPage( "file:///SDCard/BlackBerry/music/TarzanYell.mp3" );
Create a media player
To play audio on a BlackBerry® device, use the Mobile Media API to create a media player and then add
functionality to it.
Task Steps
Create a player for a
sequence of tones.
> Use the ToneControl to permit playback of a BlackBerry device user-defined sequence of tones in an
unvarying pitch.
Tempo is the bpm with 1 beat equal to 1/4 note. You determine the tempo by multiplying the tempo
modifier by 4 to keep it within the byte range of 1 to 127. Tempos in the range of 20 bpm to 508 bpm equate
to a tempo modifier range of 5 to 127.
Create a player for media
from a URL.
>Invoke Manager.createPlayer(String locator). The string must use URI syntax that describes
the media content.