Reputation: 191
Why am I getting this error? Syntax Error on token "/", Expression expected after this token.
InputStream in = getResources().openRawResource(R.raw.msgn);
FileOutputStream out = new FileOutputStream(media/audio/notifications/); // Error is in this line
byte[] buff = new byte[1024];
int read = 0;
try {
while ((read = in.read(buff)) > 0) {
out.write(buff, 0, read);
}
} finally {
in.close();
out.close();
Upvotes: 0
Views: 758
Reputation: 6736
you forgot the quotes do this:
new FileOutputStream("media/audio/notifications/");
Upvotes: 0
Reputation: 9700
You mus put media/audio/notifications/
in double-quote and pass them in a File
constructor, since FileOutputStream()
expects a File
to pass in...
FileOutputStream out = new FileOutputStream(new File("media/audio/notifications/"));
Upvotes: 0
Reputation: 157457
he is expecting a string. You need double quote
"media/audio/notifications/"
Upvotes: 5