I am creating a multimedia app that allows the user to save wallpapers and ringtones. I know the path I need to save them to is "SDCard/BlackBerry/ringtones/file.mp3" (or "/pictures" for wallpapers). I have searched forums and post for a couple days and the only thing I found was how to write text files. For now, assume that the ringtones and pictures are saved in the projects resource folder. If you could provide any input, I would greatly appreciate it.
Save media files to Blackberry SD card
3.9k Views Asked by Brian At
2
There are 2 best solutions below
3
cjp
On
Saving anything should be about the same. Try something like this:
FileConnection fc;
try {
String fullFile = usedir + filename;
fc = (FileConnection) Connector.open(fullFile, Connector.READ_WRITE);
if (fc.exists()) {
Dialog.alert("file exists");
} else {
fc.create();
fileOS = fc.openOutputStream();
fileOS.write(raw_media_bytes, raw_offset, raw_length);
}
} catch (Exception x) {
Dialog.alert("file save error);
} finally {
try {
if (fileOS != null) {
fileOS.close();
}
if (fc != null) {
fc.close();
}
} catch (Exception y) {
}
}
usedir and filename are your path components, raw_media_bytes is your data, etc etc.
Related Questions in BLACKBERRY
- Parse error google maps javascript v3 on blackberry 7
- PhoneGap with Blackberry - why isn't "date" input type giving a datepicker?
- Blackberry 10 screenshot error
- How to handle QML page orientation?
- Transition issue with BlackBerry OS 10 browser
- 'Camera' does not name a type BB10
- Which database plugin to use instead of sqlite for blackberry based phone gap app?
- How to implement Google maps in android without Google play service?
- Path location error : Program "make" not found in PATH?
- Firebase email or Facebook authentication with BlackBerry 10
- Edit list item in blackberry cascades QML
- Blackberry XPages Theme
- How to reload Page in blackberry cascades QML
- MD5 - Online Highscore table for Blackberry. How to?
- How to create an online Highscore leaderboard with azure and communicate it with Unity for WP and BB?
Related Questions in FILE-IO
- python how to write list of lists to file
- Why does command prompt show numbers before I begin?
- How can i access a js file in my project?
- I want to add a string in between of 2 strings in file, but in output whole text is getting appended at the end of file
- Where do I call an async method from?
- FileWriter() will only append, not overwrite
- How to scan several drives for specific directories?
- C language - Read specific data from text file
- NoSuchFileException when creating a file using nio
- How to force project to work only within it's directory?
- dojo 1.10 How to read text file a user has picked with a file picker
- Python Fabric - erasing my remote file when it should be copying to it
- Access Denied when trying to open with File.OpenRead
- Node.js v0.10: Replace certain bytes in file without reading whole file
- How to read a Bunch of files in a directory in lua
Related Questions in OUTPUTSTREAM
- What is meant by Streams w.r.t Java IO
- how to make a normal zip file for users in a web application using C#?
- Java HttpURLConnection OutputStreamWriter is empty
- android Bluetooth printer does not print Arabic characters (UTF-8)
- The values of int fmt in format()
- OutputStream class is used for writing into files. How is it possible?
- Android 4.1.1 ssl exception while accessing Nasa webservice
- Java IO: Reading a file that is still being written
- Given InputStream replace character and produce OutputStream
- Merge 2 large(500MB) zips which may contain files/folders with same name
- Java Piped Input/Output Stream massive delay in communication
- How to write a string to Scala Process?
- DataOutputStream write() not working
- Why do we have to use exact DataOutputStream to transfer textual data?
- error with basic java code
Related Questions in IMAGE
- Add image to JCheckBoxMenuItem
- Display images on Django Template Site
- How to resize images with PHP PARSE SDK
- Animation in Java on top of JPanel
- Slow performance on ipad erasing image
- What are the pros and cons of the picture element?
- Carrierwave file upload with different file types
- How to use annotorious with angular
- Images not showing when uploaded to server
- ImageView doesn't show up
- Image Resizing adjusts ratio
- Displaying bitmap image on Android (OpenCV)
- Class 'Imagick' not found - PHP and Windows
- Image position - randomly select position
- Replace image 1 with image 2 after 5 sec
Related Questions in RINGTONE
- Saving a sound bite as a ringtone
- Default "beep beep" alarm ringtone
- Android: EACCES Permission denied to save a file in the ringtones folder
- How to set the ringtone only for specific application?
- Android Lollipop Custom Ringtone, no permission to write
- how to play a tone from assets folder using Android ringtone manager?
- Ringtone to specific contact
- Access sound settings in iphone
- Ringtone for specific friend!!Phone restarts, Error: Could not get display information from display manager;android.os.DeadObjectException
- Android: RingtoneManager not set the default ringtone
- Setting Ringtones Inside Android App
- Android Java soundboard code only setting first button as ringtone/etc
- Android : Setting a sound from SD card as Ringtone
- Save media files to Blackberry SD card
- Need to change ringtone settings of iPhone through my app
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Thanks for your help cjp. Here is the code to saving a resource mp3 file to a sd card:
As cjp pointed out, here is how to save an image resource to a SD card: