android - How Can i change The Default Location Of My Working Directory? -


i using following method set working directory

 file file = new file(environment.getexternalstoragepublicdirectory(environment.directory_pictures), "xxxxxx"); 

now problem gives me variable location in case of phones multiple sdcards. sometimes, automatically gives me external sd card default location in phones samsung, gives me internal sdcard default location i.e. storage/sdcard0/pictures/xxxxxxx. want storage/extsdcard/pictures/xxxxxxx. don't wanna hardcode path. , also, have heard in kitkat version, not possible put files in external sdcard. how deal both problems?

note: tried changing default storage location in samsung external sdcard doesn't worked out.

depending on api requirements have tried using this:

api level 8+

context.getexternalfilesdirs() 

api level 7-

context.getexternalstoragedirectory(); 

maybe problem running on device (or simulator) api 8 or higher need use first approach. if app should support apis lower 8 suggest if then statement check actual api version this:

if (build.version.sdk_int >= 8) {     context.getexternalfilesdirs() }else{     context.getexternalstoragedirectory(); } 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -