在书上找了个例子发你看看 
应该是类似于这样的
ex05_11.java:package org.example.ex05_11;import java.io.File;
import java.util.ArrayList;
import java.util.List;import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;public class ex05_11 extends ListActivity { private List<String> items = null;
private List<String> paths = null;
private String rootPath = "/";
private TextView mPath; /** Called when the activity is first created. */
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main); mPath = (TextView) findViewById(R.id.tv);
getFileDir(rootPath); } private void getFileDir(String filePath) {
// TODO Auto-generated method stub
mPath.setText(filePath); items = new ArrayList<String>();
paths = new ArrayList<String>();
File f = new File(filePath);
File[] files = f.listFiles(); if (!filePath.equals(rootPath)) {
items.add("b1");
paths.add(rootPath); items.add("b2");
paths.add(f.getParent());
}
for (int i = 0; i < files.length; i++) {
File file = files[i];
items.add(file.getName());
paths.add(file.getPath());
}
setListAdapter(new MyAdapter(this, items, paths));
} @Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
File file = new File(paths.get(position)); if (file.canRead()) {
if (file.isDirectory()) {
getFileDir(paths.get(position));
} else {
openFile(file);
}
} else {
new AlertDialog.Builder(this).setTitle("Message").setMessage(
"权限不足!").setPositiveButton("OK",
new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub }
}).show(); } } private void openFile(File f) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW); String type = getMIMEType(f);
intent.setDataAndType(Uri.fromFile(f), type); startActivity(intent);
} private String getMIMEType(File f) {
// TODO Auto-generated method stub
String type = "";
String fName = f.getName();
String end = fName.substring(fName.indexOf(".") + 1, fName.length())
.toLowerCase(); if (end.equals("m4a") || end.equals("mp3") || end.equals("mid")
|| end.equals("xmf") || end.equals("ogg") || end.equals("wav")) {
type = "audio";
} else if (end.equals("3gp") || end.equals("mp4")) {
type = "video";
} else if (end.equals("jpg") || end.equals("gif") || end.equals("png")
|| end.equals("jpeg") || end.equals("bmp")) {
type = "image";
} else {
type = "*";
} type += "/*";
return type;
}
}main.xml:<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView
android:id="@+id/tv"  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    />
<ListView 
android:id="@android:id/list" 
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
MyAdapter.java:package org.example.ex05_11;import java.io.File;
import java.util.List;import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;public class MyAdapter extends BaseAdapter { private LayoutInflater mInflater;
// private Bitmap mIcon_one;
// private Bitmap mIcon_two;
// private Bitmap mIcon_three;
// private Bitmap mIcon_four;
private List<String> items;
private List<String> paths; public MyAdapter(Context context, List<String> it, List<String> pa) {
// TODO Auto-generated constructor stub
mInflater = LayoutInflater.from(context); items = it;
paths = pa;// mIcon_one = BitmapFactory.decodeResource(context.getResources(),
// R.drawable.outofline);
// mIcon_two = BitmapFactory.decodeResource(context.getResources(),
// R.drawable.online);
// mIcon_three = BitmapFactory.decodeResource(context.getResources(),
// R.drawable.floder);
// mIcon_four = BitmapFactory.decodeResource(context.getResources(),
// R.drawable.icon);
} @Override
public int getCount() {
// TODO Auto-generated method stub
return items.size();
} @Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return items.get(position);
} @Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
} @Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub ViewHolder holder; if (convertView == null) {
convertView = mInflater.inflate(R.layout.file_row, null); holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.text);
// holder.icon = (ImageView) convertView.findViewById(R.id.icon); convertView.setTag(holder); } else {
holder = (ViewHolder) convertView.getTag();
} File f = new File(paths.get(position).toString()); if (items.get(position).toString().equals("b1")) {
holder.text.setText("Back to /");
// holder.icon.setImageBitmap(mIcon_one);
} else if (items.get(position).toString().equals("b2")) {
holder.text.setText("Back to ..");
// holder.icon.setImageBitmap(mIcon_two);
} else {
holder.text.setText(f.getName());
if (f.isDirectory()) {
// holder.icon.setImageBitmap(mIcon_three);
} else {
// holder.icon.setImageBitmap(mIcon_four);
}
}
return convertView;
} private class ViewHolder {
TextView text;
// ImageView icon;
}}
file_row.xml:<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView
android:id="@+id/text"  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    />
    <ImageView
    android:id="@+id/icon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
</LinearLayout>