请教如何在悬浮窗中更新界面list数据?

代码如下, 我想点击"添加"按钮的时候, 加入数据到list中显示, 但是执行的时候报错Only the original thread that created a view hierarchy can touch its views, 这个该如何操作呢?

let window = floaty.rawWindow(
    <vertical w='*' bg='#FFFFFF'>
        <button id='add'>添加</button>
        <list id='todoList'>
            <vertical>
                <text text='标题' textColor='#999999' textSize='12sp' />
                <text text='{{this.title}}' textColor='#222222' textSize='14sp' />
            </vertical>
        </list>
    </vertical>
);
window.setSize(600, -2);
window.setPosition(200, 200);
let todoList = [{title: '测试1'}];
ui.run(function() {
    window.todoList.setDataSource(todoList);
})
window.add.click(function() {
    ui.run(function() {
        todoList.push({title: '测试' + Math.random()});
    })
});

报错信息:

01:56:01.322/E: Wrapped android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. Expected: main Calling: ScriptThread-22[[remote]test1] (/android_asset/modules/__ui__.js#277)
Wrapped android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. Expected: main Calling: ScriptThread-22[[remote]test1]
    at /android_asset/modules/__ui__.js:277:0
    at /android_asset/modules/__ui__.js:271:0
    at /android_asset/modules/object-observe-lite.min.js:2:0
    at /android_asset/modules/object-observe-lite.min.js:2:0
    at /android_asset/modules/object-observe-lite.min.js:2:0
    at /android_asset/modules/object-observe-lite.min.js:2:0

已经解决了, 把数据复制一份进行修改, 再重新setDataSource就可以了

ui.run(function(){
    let window = floaty.rawWindow(
        <vertical w='*' bg='#FFFFFF'>
            <button id='add'>添加</button>
            <list id='todoList'>
                <vertical>
                    <text text='标题' textColor='#999999' textSize='12sp' />
                    <text text='{{this.title}}' textColor='#222222' textSize='14sp' />
                </vertical>
            </list>
        </vertical>
    );
    window.setSize(600, -2);
    window.setPosition(200, 200);
    let todoList = [{title: '测试1'}];
    ui.run(function() {
        window.todoList.setDataSource(todoList);
    })
    window.add.click(function() {
        ui.run(function() {
            let arr2 = todoList.concat();
            arr2.push({title: '测试' + Math.random()});
            todoList = arr2;
            window.todoList.setDataSource(todoList);
        })
    });
})