• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Listview wont update again after the first time!

So after two days of fruitless bashing my head against a desk, I am at my wits end with this android app I'm making. Basically, it populates a listview, each row containing 3 values that will be updated at a specified interval. The values are blank on startup but are initialised after the first run through the code.

However, every other time the listview wont rewrite itself! Logcat tells me the updated values are being passed in but the adapter won't update. Can anyone point out the no doubt obvious mistake I'm making.

Code:
adapter = new snmpAdapterView(this, parsedObjects);
        setListAdapter(adapter);
        
        Timer tim = new Timer();
        
        tim.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                
                doit();
                Log.e("NOTE", "done");
                Log.e("empty?", adapter.isEmpty()+"");
                
                 }
            }, 0, 10000);
The method doit()

Code:
public void doit() {
        Log.e("","Initialised");
        ExecutorService pool = Executors.newCachedThreadPool();

        for (int i = 0; i < parsedObjects.size(); i++)// submit threads equal to
                                                        // // number of objects
        {
            snmpObject s = parsedObjects.get(i);
            pool.submit(s); // run the i'th object instance
        }
        pool.shutdown();

        try {
            pool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
        } catch (InterruptedException e) {

        }
        
        handler.post(new Runnable() {
            public void run() {
                Log.e("update", "true");
                adapter.setList(parsedObjects);
                adapter.notifyDataSetChanged();
            }
        });

    }
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones