Development of the android File Browser

Source: Internet
Author: User

Contains detailed file browsingSource code. For more information, see.
/M. D1 {% zr5gim3, but unfortunately there are no file-related operations. I usedFileBut for createnewfile, mkdir, and so on, I don't know why. 3 geye $ 'I # kn-N # @/
3geye1x) ka, w3qi .}
For more information, see the source code.
: K * KK) py2x "_ 33 geye (t6wxo Ge/s4sl, c
Package org. lombardos. Android. fsexplorer1;
Xscb/fal3
/}] 2j "plbuy3importJava. Io. file; 3 geyeo {| Qn @
Import java. util. arraylist; 3geyec0nq; '/y
Import java. util. List;
%} 0 @/Yi! A3
^ 0kk8 'C, ke "C $ | 3 ImportAndroid. App. alertdialog; 3 geye % Y z0c $ q ~ Hpy (I
Import Android. App. listactivity; 3geye7u0v U-sy $ P; WMB
Import Android. OS. Bundle; 3geye8tw-n7 | 4X
Import Android. View. view;
8 W @ 4O $ N,/3 Import Android. widget. arrayadapter;
Ex, dkx) | tg9h3import Android. widget. listview;
_ U) l0cme: Y3
"E @? 0 p # np3public class filelist extends listactivity {3 geye [} + ol8 | $ zd0fz

'/X $ A. x} 3 V + {s6Z-s7o3 private list <string> items = NULL;
2O! Si6? # @ Q3
5pu * ygm ~ B1f3/** called when the activity is first created .*/
Csjbr3 @ override3geye2] 3? GT & p0r/y
Public void oncreate (bundle icicle ){
7 s, YG] 5tlci_3 super. oncreate (icicle); 3 geye "g; y" WUO eh * k EW
Setcontentview (R. layout. directory_list); 3geye2mi7 ~ Hyt * w
Fill (new file ("/"). listfiles ());
Fh3b [2p0f $ Q3} 3 geye: Q # ^ Q $ Mn '6p

W''asiq0m3 @ override
T _-RR # GV! B3 protected void onlistitemclick (listview L, view V, int position, long ID) {3geyew2uf + p5' s
Int selectionrowid = (INT) getselectionrowid (); 3 geyenmduc D;] l
If (selectionrowid = 0) {3geyeb | 9ue :~ 5N
Fillwithroot ();
/Lm5] 2 k e9t_3} else {
? /$ ~. P {3 File file = new file (items. Get (selectionrowid); 3 geye Q & nlmo-R _
If (file. isdirectory ())
Jt4s + XO? % Ze: R3 fill (file. listfiles ());
W! TD-v8b7p3 else3GEYE-Yd.u3Gpu5S
Alertdialog. Show (this, "not a directory", 3 geye VZ *? /A4 {, R
"That's a file, not a directory", "cancel", false );
; TT) l} + mz7vcun $ CH3}
DvCn_F-k2Na3}
5 xzsd, ne3
K QUS @ P3X H-[3 private void fillwithroot (){
'N' + S) P & | # m3 fill (new file ("/"). listfiles (); 3 geyel/o] (_. DL/P
}
"EC 'meurg3
Tk7h1 | v6a (Y: M * oy3 private void fill (file [] files ){
) ^ R4a4q tp % bub3 items = new arraylist <string> ();
H5k # is "s? Rdz3 items. Add (getstring (R. String. to_top); 3 geyeo "'tb? *? 6b
For (File file: files)
, JC] r4h3 items. Add (file. getpath ());
Gh6hgy .? 6ik3 arrayadapter <string> filelist = new arrayadapter <string> (this, 3geye * ty "E/character # C" x Z
R. layout. file_row, items );
Gcf7w8pl3 setlistadapter (filelist); 3 geyenv D/Zi I
} 3 geye [O *~ S + G-C # l
} 3 geyelg $ J @ C

9A % ZB 'W + Q' fu3/* auto-generated file. Do not modify.3geyeg. nzggp: Ke C
*
M ^ % P; P' (R3 * This class was automatically generated by the3geyemvuo {jue5qbi
* Aapt tool from the resource data it found. it3geye $ G & B 'v {? Z "zx
* Shoshould not be modified by hand.3geye B g. _ r4h3 {8 ^ B # f9m
*/3 geyeztd} t1yap W

. Y [G + i7 [T ,~ 7z # G] r3package org. lombardos. Android. fsexplorer1; 3 geye C {$ {"[s}

} # Wblh) w3public final class r {
! Ty W) i9j & u7 [E3 public static final class ATTR {3geyep0l e2y "nje-n
}
# | Up6ocdq3 public static final class drawable {3 geyei (Q ~ : Jgzu/d' 2D
Public static final int icon = 0x7f020000;
Htzoq6 [E [3} 3geye5wc: r5jv * g
Public static final class ID {
'L8f % I % J "kb, Z; kx" Q3 public static final int text1 = 0x7f050000;
"} 4D s {vt} 3}
& Ft. B. {H3 public static final class layout {
$ Cxs, |-ot5d} 3 Public static final int directory_list = 0x7f030000;
% R) Up | r (o3r % N3 public static final int file_row = 0x7f030001; 3 geye + O * eqe) XA, L [
Public static final int main = 0x7f030002;
! Y4c1vokw9 '3}
% A/R * xgz @ 9c4? 3 Public static final class string {
0sc WJ, Q3 public static final int app_name = 0x7f040000; 3geyeqex_f
Public static final int no_files = 0x7f040001;
Z) lg (U "VN) T3 public static final int to_top = 0x7f040002; 3geyejp * Ai + A] r1r
} 3 geye & qqaqv
}

 

By the way

Specific permissions are required for file operations.

I cannot operate under data

For TMP

Because Android uses a Linux system, there should be a home in the directory structure. You can save the data here.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.