android - How to select file from internal & external storage in andorid -
hi trying create file selector select file device , upload server.so tried few example same every time stuck @ shows internal storage drive of device not external storage. tried example here file explorer example
but same shows internal sdcard. when
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); currentdir = new file("/sdcard/"); fill(currentdir); }
and if change mnt show option external storage after pressing button..
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); currentdir = new file("/mnt/"); fill(currentdir); }
what want when click on browse button should show 2 option's 1 internal storage , second external storage per device config. i.e if has these drives.
thanks in advance....
for external storage.
string path = null; if (build.version.sdk_int < 8) { path = root.getabsolutepath() + "/android/data/com.packagename/files/"; } else { file file = getexternalfilesdir(null);//getabsolutepath(); if (file == null) { path = root.getabsolutepath() + "/android/data/com.packagename/files/"; } else { path = file.getabsolutepath(); } }
for internal storage can use
fileinputstream stream = context.openfileinput("sp_key_file");
Comments
Post a Comment