Code example for Stack

Methods: isEmpty, pop

0
        setListAdapter(mAdapter);
    } 
 
    @Override 
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && !mPrevFolders.isEmpty()) {
            File folder = mPrevFolders.pop();
            loadFolder(folder);
            return true; 
        } else { 
            return super.onKeyDown(keyCode, event);
        } 
    } 
 
    @Override 
    protected void onStart() { 
        super.onStart(); 
 
        loadFolder(Environment.getExternalStorageDirectory());
    }