0

I'm trying to implement a set of methods that read from and write to text files in External Storage in android (18, 4.3.1). I normally use AssetManager, but that's read only.

I want to initialize these files with values, but I don't know where the External Storage directory is in the Eclipse project folder. The method I'm using to get the path is the following:

        File sdCard = Environment.getExternalStorageDirectory();
        File file = new File(sdCard, "passwords.txt");

        ...

Edit: This may have been written confusingly. I want to know where to put my text file in my eclipse project so that the Android Virtual Device loads it into External Storage, and I can find that path.

  • Right click on the project and see properties u will get where your project is stored on disk. – Vipin Nov 24 '14 at 06:36
  • Goto the properties of the file whichever is needed and check for the 'Location'. This will be the absolute path from external storage area! – janasainik Nov 24 '14 at 06:37
  • No, I want to get the potential file path, so that I can put them there. They aren't there yet. – Steven Koza Nov 24 '14 at 06:51
  • There is no specific folder in eclipse which holds the SD card files. You have to copy it to SD card programmatically. – Deepzz Nov 24 '14 at 06:59
  • I just need it to be loaded into an Android Virtual Device - there's no way to do that? – Steven Koza Nov 24 '14 at 07:00
  • Is this the one you are searching?? http://stackoverflow.com/questions/2808632/manually-put-files-to-android-emulator-sd-card – Deepzz Nov 24 '14 at 07:02
  • Yes, this is exactly it, my virtual device isn't showing up in DDMS now though. Crap. – Steven Koza Nov 24 '14 at 07:08
  • create a new device and check.. – Deepzz Nov 24 '14 at 07:11
  • For whatever reason, its not detecting them, I've made 3 with SD cards now and they're not being detected by the DDMS perspective. It looks like there's a way to create an SD Card File... Maybe there's a simpler way to do this using internal storage... – Steven Koza Nov 24 '14 at 07:21

1 Answers1

0

if u want to see your stored file. you can see these file into Your device. if You want to initialize the file object then You need to provide the absolute path of the file which is in your device. it is not related with eclipse

if u want to know the absolute path. go to file file manager in our device and check those file there. all the file Which You Stored into the external storage, available in that directory

Umesh Kumar Saraswat
  • 758
  • 3
  • 10
  • 28
  • tell me where you Stored the file. then i will tell you the absolute path – Umesh Kumar Saraswat Nov 24 '14 at 06:57
  • I haven't stored it yet. I want to know where to put it in eclipse so that I can reference it in Android's External Storage using the above code. – Steven Koza Nov 24 '14 at 06:58
  • You said that you want to initialize the file. but to initialize the file you need that file. so i m saying that Where That file is stored in Your mobile – Umesh Kumar Saraswat Nov 24 '14 at 07:01
  • I'm asking the same thing. I don't know where to put it so that its loaded into my Android Virtual Device's External Storage. I'm not using a physical device. I don't actually have an SD card. – Steven Koza Nov 24 '14 at 07:04