5 messages in com.googlegroups.android-beginners[android-beginners] Re: How to create...| From | Sent On | Attachments |
|---|---|---|
| butterflying | 21 Jul 2008 18:18 | |
| Mark Murphy | 22 Jul 2008 04:26 | |
| butterflying | 23 Jul 2008 01:57 | |
| sacoskun | 23 Jul 2008 02:21 | |
| Dave Hallam | 23 Jul 2008 02:33 |
| Subject: | [android-beginners] Re: How to create directories on sdcard?![]() |
|---|---|
| From: | sacoskun (saco...@gmail.com) |
| Date: | 07/23/2008 02:21:05 AM |
| List: | com.googlegroups.android-beginners |
Hello butterflying,
I don't think it is possible and meaningful to access your computer from the emulator inside.
You can use a web service to get a file from outside of the emulator, and copy it to your location in Android.
Regards, sacoskun
On Jul 23, 11:58 am, butterflying <y....@hustunique.com> wrote:
Thanks a lot for your replies. I've resolved that problem, but I ran into another one: is there any way that i can push a file into the sdcard in source code? like if(true) { // code to push a file into "/sdcard/mp3s"}
Thank you so much!
On 7月22日, 下午8时48分, jdav...@gmail.com wrote:
Hi.
I provide additional information on how to handle and upload files to a scdard emulator. Hope you find it useful!!!
1. create the sdcard: 1. create a directory EX: c:\temp 2. open a command prompt and gothe the directory. 3. make the sdcard via the command: mksdcard <size> sdcard.img
2. Add mp3 files to the card: 1. start the android emulator with sdcard support: - under the run menu click "open run dialog" - make sure to highlight the correct project - click the tab marked "Target" - under the additional emulator commands enter: -sdcard c:/ temp/ sdcard.img
2. open up a command prompt in windows: - in one window enter "adb shell" - you now can browse the emulator file system via commands like ls and cd - type ls and confirm you have a directory named sdcard. - type "cd sdcard" to change to that directory.
3. open up another command prompt - add mp3 files to the sdcard via adb push: Here's an example:
adb push "Michael Tarbox and Howard Ferguson - Beautiful City 2-4-03 Plough & Stars.mp3" /sdcard/"Michael Tarbox and Howard Ferguson - Beautiful City 2-4-03 Plough & Stars.mp3" 218 KB/s (0 bytes in 2889576.012s)
4. confirm addition of mp3 file: - enter ls under the adb shell: # ls ls android Amy Winehouse - Back to Black.mp3 Sheryl Crowe - The First Cut Is The Deepest.mp3
On 22 jul, 07:26, Mark Murphy <mmur...@commonsware.com> wrote:
butterflying wrote:
Hi, I recently learnt how to create an sdcard image but I can't figure out a way to create directories on it. So would anyone tell me how to do it?
Assuming there aren't permission problems, something like this should work:
import java.io.File;
// other really cool code here
File f=new File("/sdcard/make/mine/malted");
f.mkdirs();
There's also a mkdir() method to just create the directory named in the final path segment.
I have only attempted to read from the SD card, so it's entirely possible activities lack write access, but that would surprise me.
-- Mark Murphy (a Commons Guy)http://commonsware.com Warescription: All titles, revisions, & ebook formats, just $35/year- 隐藏被引用文字 -
- 显示引用的文字 -
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to andr...@googlegroups.com To unsubscribe from this group, send email to andr...@googlegroups.com Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---




