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 answers
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
- Why doesn't Blackberry Hub+ Calendar update events with given UID?
- Blackberry Workspaces
- Can any EDM like Android Enterprise, Blackberry UEM or Intune enable Accessibility Service or change any other system setting for an Android app?
- iOS - Accessing Certificates enrolled by Blackberry UEM
- can not do blackberry z10 app developement
- BlackBerry Dynamics SDK: Specific Cookies Set in the HTTP & XMLHTTP Response via the "Set-Cookie" header are not being set in the WebView
- Build of Xamarin iOS app fails on VS for Windows when using dynamic version of BlackBerry Dynamics SDK
- How to open downloaded documents file from blackberry access in windows explorer
- How to enable App Store reviewers to test Blackberry Dynamics apps
- How to attach a SSL certificate in a request call using GDHttpClient in Blackberry Dynamics | Android
- How to load www folder(html files) from internal storage to BBDCordovaWebview?
- Blackberry Dynamics - authentication via oAuth does not call back to the main app
- Launch Outlook from Blackberry Dynamics app
- Unable to set cookie in WKWebView using "Set-Cookie in BlackBerry Dynamics app
- BB10 signing migration
Related Questions in FILE-IO
- Data loaded from the file is not returned in the correct order
- C++ File Input Skipping Lines
- Reading many rows of a 2D array from file in C++
- How to get character position in a text file encode in UTF-8 in C?
- Open File in Python and viewing contents of that file
- Powershell Script to Replace Text in Text File, but not save to new file
- In a text file, count lines from string 'foo' to first empty line afterwards. Raise exception if 'foo' not found
- NoClassDefFoundError and ClassNotFoundException when reading data from a csv file using opencsv in java
- How to access a module inside of a module from a file inside the first module in python?
- Sorting a binary file with structs
- How Dask manages file descriptors
- Issues when Reading Preferences from Input File in Java for Stable Matching Problem
- Merge 2 directories and overwrite files with same name
- Flowchart Symbol for File Input Output Java
- Can't access files with a relative path when compiled into a jar
Related Questions in OUTPUTSTREAM
- Getting output stream of a process in Java
- FFmpeg output video is not seekable. Output video is not playing instantly instead browser loads it completely then plays it
- No output from 'for' loop - indefinite run
- Jenkins Groovy HttpURLConnection PUT request failing while creating writer
- Download File Missing Inserted Data
- Why JUnit tests using ByteArrayOutputStream fail when running multiple tests but pass when run individually?
- Problem with tcp socket write not working
- print() method of a socket output stream doesn't work
- Java - Unable to delete temporary output file for Process on Windows
- Read, encrypt, zip and send a file without rewriting it
- Clone clog output stream with C++
- Record Frame by Frame into a byteArrayOutputStreamVideoData and Save to a File
- How to know if an OutputStream can continue writing in Java?
- When I use JSch, can I use custom OutputStream with the socket?
- Simple echo java socket program is not working for me
Related Questions in IMAGE
- Golang lambda upload image into s3 static website
- Put an image behind the title in a WP, WooCommerce "shop" page
- How to create an JSOUP element from byte array image (Load from Database)
- Cloudflare not respecting Cache-Control
- Sending multiple images and data in a single angular observable
- Create and combine several images into a single image for my react native App
- Should I compress images in java backend before sending to frontend?
- Javascript Place Image Where User Clicks
- Whitespace in document has a bottom border remnant or some other line at the bottom of the whitespace
- Sony Spresense Camera Board
- After completely installation and done all the work i am getting Permission denied error do any one have solution
- HTML page on NAS server image not showing on mobile phone
- mouse coordinates in image go below 0 and above width
- Why are the css images or js not loading in my laravel project?
- Python pillow library text align center
Related Questions in RINGTONE
- I am unable to set ringtone using activity in android studio?
- How to set ringtone in Android from my activity on upcoming Android 14 (UPSIDE_DOWN_CAKE API 34)?
- The application does not work on newer versions of Android (version 9 and above)
- How to retrieve the original default ringtone that came with the Android device?
- Can I Stop Original ringtone and play my custom ringtone time of incoming call in swift?
- How to play system sound in flutter web?
- set custom Sound from only my application in push notification android
- How to make IN_CALL_SERVICE_RINGING work?
- How to get ringtone path in android
- Alarm manager or sound notification are not working in release mode Android 13
- How to use media player for play a ringtone while one signal notification received in android
- How to make a alarm open a new activity android studio kotlin
- Setting ringtone to different sim cards Android
- Ringtone not playing on certain Samsung devices with Android 11
- java.lang.IllegalArgumentException: Invalid column: _data
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?
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)
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: