/** * When a user selects an item: - If it's a directory, load that directory. - If it's a file, open * the SheetMusicActivity. */ @Override protected void onListItemClick(ListView parent, View view, int position, long id) { super.onListItemClick(parent, view, position, id); FileUri file = (FileUri) this.getListAdapter().getItem(position); if (file.isDirectory()) { this.loadDirectory(file.getUri().getPath()); return; } else { ChooseSongActivity.openFile(file); } }
@Override public void onResume() { super.onResume(); rootdir = Environment.getExternalStorageDirectory().getAbsolutePath(); directoryView = (TextView) findViewById(R.id.directory); SharedPreferences settings = getPreferences(0); String lastBrowsedDirectory = settings.getString("lastBrowsedDirectory", null); if (lastBrowsedDirectory == null) { lastBrowsedDirectory = rootdir; } loadDirectory(lastBrowsedDirectory); }
@Override public void onCreate(Bundle state) { super.onCreate(state); setContentView(R.layout.file_browser); setTitle("MidiSheetMusic: Browse Files"); }