您好,登錄后才能下訂單哦!
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
出現(xiàn)異常的原因:
在observer中去調(diào)用load()方法,并且load()方法又去操作界面上的控件.
private ContentObserver observer = new ContentObserver(null) { public void onChange(boolean selfChange, android.net.Uri uri) { Cursor cursor = context.getContentResolver().query(DataProvider.getUri(), null, SimpleDataColumns.MODULE + "= ? ", new String[]{Constants.PROGRAM}, null); Logger.v(TAG, "@onChange. remind.cursor.count >> " + cursor.getColumnCount() + ", remind.list.size >> " + tvRemindList.size()); if(cursor.getColumnCount() != tvRemindList.size()) { load(); } } };
改成在Handler中調(diào)用load()方法就沒(méi)有這個(gè)異常.
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。