Android: notifyDataSetChanged(); not working

后端 未结 8 1544
旧时难觅i
旧时难觅i 2020-11-28 10:33

I have a database in a server and from a Tablet I take some values from one table in the database. I load this information correctly into a list but I would like to know why

8条回答
  •  無奈伤痛
    2020-11-28 11:03

    The thing you need to edit is put your

    runOnUiThread(new Runnable() {
                    public void run() {
                        /**
                         * Updating parsed JSON data into ListView
                         * */
                        adapter = new SimpleAdapter(
                                Monitorizacion.this, candidatosList,
                                R.layout.list_item, new String[] { TAG_NSERIE,
                                        TAG_DNI, TAG_NOMBRE, TAG_TEST, TAG_PREGUNTA, TAG_BATERIA},
                                new int[] { R.id.id, R.id.dni, R.id.nombre, R.id.test, R.id.pregunta, R.id.bateria});
                        setListAdapter(adapter);
                        adapter.notifyDataSetChanged();
                    //  timer();
                    }
                });
    

    into the OnCreate(). and return the list candidatosList from Asynctask. than set timer for updating candidatosList list.

提交回复
热议问题