开发者

Copying files from PC to tablet in a folder I made from an app, not possible?

开发者 https://www.devze.com 2023-03-27 02:50 出处:网络
EDIT:After realizing I have to make things public so to speak this is what I attempted to create a folder I could see when plugging the tablet in from my pc and copying stuff over there:

EDIT: After realizing I have to make things public so to speak this is what I attempted to create a folder I could see when plugging the tablet in from my pc and copying stuff over there:

File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) ;
    File theFile = new File(path+"/Portfolio/");
    //if(!theFile.exists())
        theFile.mkdir();

I commented out the if theFile.exists() cause it was always returning true.

So now I have this folder that seems to work, no errors are thrown and the folder should be created in fact I am using Adao File Manager on the device to browse to this location it is indeed there under /Pictures/Portfolio

but when I plug it into my windows machine, i see /Pictures but no folders underneath it, am i just losing it?

Okay so

I have these little DIR is make on my tablet from my application, to put client files into. I thought I could just connect the tablet up and copy files from my PC to these folder I had made. The thing is when I plug my acer iconia in, while it shows up and I can browse some files it seems the folder I made in the app using File.mkdir(); is this path:

/sdcard/Android/data/my.softwares.package.name/files/Pictures/somefolders

while I can use a 3rd party file browser app to see this folder does exsist as far as I can tell from windows i can only browse as far as:

/sdcard/Android/data (if im even getting there not sure).... is this really the case or am I missing something? The code I use to create these folders is:

   String p = Environment.DIRECTORY_PICTURES + "/" + s.getClient().getFirstName()+s.getClient().getLastName() + "/" + s.getPackage().getName() + (mSession.getSessionDate().getMonth()+1)  +  mSession.getSessionDate().getDat开发者_开发百科e() + (mSession.getSessionDate().getYear()+1900);
            File path = mContext.getExternalFilesDir(p);


            if(!path.exists())
                path.mkdir();

Seems no luck here when I plug my tablet into the pc, again only can go as far as Android/data

So this is for a portfolio like program, I want to create a folder on the device, users can copy pictures to from their pc, then the same app that created the folder can read this folder later on after the pictures have all been copied over, so what am I missing since my assumption of windows being able to read everything on the sdcard seems false?


You have created the pictures in the private data area of your app and therefore do not have access to it. That would be a security problem.

Save the data to a public location like the sdcard. Just read up on external storage.

http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

0

精彩评论

暂无评论...
验证码 换一张
取 消