Code example for Stack

Methods: isEmpty, peek

0
			e.printStackTrace();
		} 
    } 
 
	public BaseViewController topController() { 
		if(!mControllerStack.isEmpty())
			return mControllerStack.peek();
		else 
			return null; 
	} 
     
    @Override 
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        //super.onKeyDown(keyCode, event); 
 
        boolean result = false;
		try { 
			if(topController() != null) 
				result = topController().onKeyDown(keyCode, event);
		} catch (Exception e) {
			e.printStackTrace();