Which path system, the program can be easily used? ?
RT Machine yard no sd card, wanted in the program where the path (like "/ data / data / com.example.XXXXX / files") which create and play amr files, but encountered a problem ...
I created in "/ data / data / com.example.XXXXX / files" inside and write amr files can be, but when the play was an error. Using MediaPlayer, when setDataSource or prepare catch the error "prepare failed:. Status = 0x1", check the seemingly insufficient permissions ...
online read, mention the right way, the test did not succeed ... anyone provide some information, connections, etc.? ? Alternatively, there is a directory which can be used directly? ? That is not to mention the right you can read, write, create, delete, play? ? ? Please advise, thank ~ ~ ~
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) -> Reply: This directory can assert the Reply: What is reported is wrong? The landlord posted an error to
This case, I guess there might be need to declare AndroidManifest appropriate permissions to read media, right? Reply:
Permission to read and play Reply:
Apart from this, but also what is not? Reply:
Program to read and write files, in addition to adding
, But also pay attention to the directory you want to read and write, android system does not have write permissions to be able to post operating all directories. If there sd card, add permissions to read and write files directly after. If there is no sd card, you can get this program private cache directory, this directory is that you can easily operate. Such as directory Android / data / com.example / cache, Under no circumstances sd card, you can
context.getCacheDir (). getPath ()
to get the private cache directory your program
Reply:
OK, very grateful, to try to Reply:
without the sd card case, you can
context.getCacheDir (). getPath ()
to get the private cache directory of your program
context is not getApplicationContext () achieved? Seemingly, nor ah ... inside the virtual machine is OK. Reply:
Under no circumstances sd card, you can
context.getCacheDir (). getPath ()
to get the private cache directory of your program
context is not getApplicationContext () achieved? Seemingly, nor ah ... inside the virtual machine is OK.
Yeah this is obtained. If you get to be null, then try the Activity onCreate function in a direct access to this:
this.getCacheDir (). getPath ()
You say no, what steps are wrong? You get to see the actual print out the cache path there is no such path. Reply:
Under no circumstances sd card, you can
context.getCacheDir (). getPath ()
to get the private cache directory of your program
context is not getApplicationContext () achieved? Seemingly, nor ah ... inside the virtual machine is OK.
Or put your log posted, so to say too general, can not help you analyze. Reply:
assert this directory is possible
People are created dynamically, assets God horse? Reply: Thank you, now test,
TandyT said is right, like "Android / data / com.example / cache" directory is possible,
I say the roof of "/ data / data / com.example.XXXXX / files" is also possible. Check it out when I did not pay attention to the comment, setDataSource not commenting, write new code below Shiyou setDataSource once, so have the wrong ... Reply: Oh, careless of @ _ @ Enough to solve the
No comments:
Post a Comment