http://dl.vmall.com/c0bvxnkozt
封装了 直接调用就可以 调用方法如下:
package com.debby;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MainAcivity extends Activity {
public static final int FILE_RESULT_CODE = 1;
private TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.button);
textView = (TextView) findViewById(R.id.fileText);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(MainAcivity.this,
FileManagerActivity.class);
startActivityForResult(intent, FILE_RESULT_CODE);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (FILE_RESULT_CODE == requestCode) {
textView.setText("选择文件夹为:" + data.getStringExtra("file"));
}
}
}