@Override public void onComplete(List<News> mNewsList) { mMainView.hideLoading(); Logger.show(TAG, "onComplete()"); /** * 这里若直接调用showNewsList(),就会发生 android.view.ViewRootImpl$CalledFromWrongThreadException: Only the * original thread that created a view hierarchy can touch its views. 只能在主线程中更新UI 所以就用Handler了 */ Message msg = Message.obtain(); msg.what = FETCH_NEWS_SUCCESS; msg.obj = mNewsList; mUIHandler.sendMessage(msg); }
public void fetchNews() { mMainView.showLoading(); mNewsModel.getNewsFromInternet(); }