【Android开发坑系列】之try-catch
try { mViewPager.postDelayed( new Runnable() { @Override public void run() { getCurrentPage().render( false ); } }, 500 ); } catch (Exception e) { // 可忽略的异常 LogUtil.i(TAG, "=====" ); } 上面的写法实际上catch不到getCurrentPage().render(false)的异常,postDelayed会造成getCurrentPage().render(false)执行延迟 而需要这样写。 mViewPager.postDelayed( new Runnable() { @Override public void run() { try { getCurrentPage().render( false ); } catch (Exception e) { // 可忽略的异常 LogUtil.i(TAG, "======" ); } } }, 500 ); 本文转自Kai的世界,道法自然博客园博客,原文链接:http://www.cnblogs.com/kaima/p/3179703.html,如需转载请自行联系原作者。