在API 19上获取java.util.ConcurrentModificationException

时间:2016-11-09 11:23:16

标签: java android listview

在api级别19应用程序在计算垃圾文件时发出此异常... 我知道它有一些迭代问题,但是如何克服它

    protected Void doInBackground(Void... params)
{
    m_oNotificationManager =(NotificationManager)oContext.getSystemService(Context.NOTIFICATION_SERVICE);
    m_o_globalClass = (GlobalClass) oContext.getApplicationContext();
    StorageDetect.prepareStorageList(oContext);
    if(m_o_globalClass != null)
    {
        m_o_globalClass.getJunkManager().initReclaimable((byte) (JunkManager.m_kEmpty | JunkManager.m_kLog | JunkManager.m_kTemp));
        for (Storage obj : m_o_globalClass.getStorageList())
        {
            // sz_storage contain the path(mountpoint) of the the storage.
            String sz_storage = obj.m_sz_path;
            File o_file = new File(sz_storage);
            //here condition checking for usb.if mount point will contain the below keyword than it will not find the file for this mount point.
            if (o_file.toString().toLowerCase().contains("usb") || o_file.toString().toLowerCase().contains("usbdisk") || o_file.toString().toLowerCase().contains("usbcard") || o_file.toString().equals(Environment.getDataDirectory().getPath()))
            {
                continue;
            }
            getEmptyFolder(o_file);
            getLogFile(o_file);
            getTempFile(o_file);
        }
    }
    return null;
}

0 个答案:

没有答案