1

My application when I click a buttons is freezing and in anroid monit I see :

03-22 13:01:33.490 25636-26150/com.smok.maps D/dalvikvm: GC_FOR_ALLOC freed 2468K, 11% free 29508K/32996K, paused 65ms, total 65ms
03-22 13:01:36.914 25636-26150/com.smok.maps D/dalvikvm: GC_FOR_ALLOC freed 3957K, 17% free 28675K/34324K, paused 54ms, total 54ms
03-22 13:01:37.744 25636-25636/com.smok.maps I/Choreographer: Skipped 271 frames!  The application may be doing too much work on its main thread.
03-22 13:01:39.907 25636-26150/com.smok.maps D/dalvikvm: GC_FOR_ALLOC freed 3903K, 19% free 27910K/34324K, paused 42ms, total 42ms

This is an action what I do :

 btUnselectAll.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                getActivity().runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
//                        for (RowBean aRowBean_data : rowBeen) {
//                            aRowBean_data.setSelected(false);
//                        }
                        for (RowBean rowBean : Adapter.data) {
                            rowBean.setSelected(false);
                        }
                        adapter.notifyDataSetChanged();

                        for (ObjectDefExtends objectDefExtends : Singleton.getInstance().getListaODE()) {
                            objectDefExtends.visible = false;
                            editor.putInt(objectDefExtends.id.toString(), 0);
                            editor.apply();
                        }
                    }
                });
  • 2
    Is there a lot of data in your `adapter` ? – Paresh P. Mar 22 '17 at 12:05
  • This is a duplicate of http://stackoverflow.com/questions/14678593/the-application-may-be-doing-too-much-work-on-its-main-thread – Leo Nawroth Mar 22 '17 at 12:07
  • @Wizard data size in adapter is equls 154 –  Mar 22 '17 at 12:12
  • What happens when you only wrap `runOnUiThread` around `adapter.notifyDataSetChanged()`? From what I can see, none of the other code in your example should be touching the UI. – Michael Dodd Mar 22 '17 at 12:14
  • The link above explains what is exactly want wrong in your code. Try to reduce the number of items to be bind at a time. use funda of pagination instead. – Paresh P. Mar 22 '17 at 12:18

0 Answers0