Browsing directory of an Android device using Python -



Browsing directory of an Android device using Python -

i user able view & navigate directories of android device when click "browse" button, able take folder photos stored.

as of now, can go "adb shell", not able come in more commands interact while connected device via adb shell. connect device via adb shell , cd or run other commands after connecting device. current code horrible not understand "stdout=subprocess.pipe" mean , next online tutorials.

here current code:

from subprocess import check_output import subprocess out = check_output("adb shell ls") print out destination = raw_input("choose folder: ") p = subprocess.popen("adb shell",stdout=subprocess.pipe) out, err = p.communicate() g = subprocess.call(['cd', destination], stdout=subprocess.pipe) out, err = g.communicate() print out

i appreciate help , guides given. give thanks in advance.

i'll suggest utilize android functions iterate directories , files. illustration create new file, of course of study if making in java (and might easier):

file currentdir = new file("/"); // "/" stands root directory file[] files = currentdir.listfiles(); // lists files in current directory, store them in *files* array //you can supply argument string[] array, file extensions if needed //(to show .jpeg, .png, or documents .docx, .pdf) //you can utilize collections , comparator classes sort them if(files != null && files.length > 0) { //check if holds files for(file f : files) { if(f.ishidden()) { // don't add together hidden file list, or @ selection continue; } else { // add together file list filelist.add(f); } } collections.sort(filelist, new filecomparator()); // } //you can check if specific *file* file or directory file.isfile(); file.isdirectory();

you can utilize info files show them in listview or gridview, on click on specific item, can update currentdir , refresh contents or open file, etc.

here illustration of file chooser http://www.dreamincode.net/forums/topic/190013-creating-simple-file-chooser/

android python adb

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -