Android Permission denial in Widget RemoteViewsFactory for Content

后端 未结 3 2080
太阳男子
太阳男子 2020-12-15 08:09

I have a widget which I am trying to use to display information from my app\'s local database inside of a listview.

I\'m using the RemoteViewsService.RemoteViewsFact

3条回答
  •  忘掉有多难
    2020-12-15 08:31

    Put this in your onDataSetChanged() method:

        Thread thread = new Thread() {
            public void run() {
                query();
            }
        };
        thread.start();
        try {
            thread.join();
        } catch (InterruptedException e) {
        }
    

    Fetch data from the database inside query() method. I do not know why fetching data in a separate thread helps get around this problem, but it works! I got this from one of the Android examples.

提交回复
热议问题