Issue with bitmap items in XMLPullParser

前端 未结 1 1956
死守一世寂寞
死守一世寂寞 2021-01-29 10:46

According to stackoverflow searching, this question exactly describes what I need to understand now, but there are no answers or comments and It viewed only 6 times:

XML

相关标签:
1条回答
  • 2021-01-29 11:12

    The issue is that AsysForBitmap is not finishing the job while you are reading the next item and myBitmap will be overlapped with the next image.

    Try to do it like this

               case XmlPullParser.START_TAG:
                   tagname = parser.getName();
                   if (parser.getName().equals(iconsrc)){
                       iconsrcVALUE = parser.getAttributeValue(null, "src");
                       SomeItem item = new SomeItem(displaynameValue, myBitmap);
                       item.setName(displaynameValue);
                       item.add(item);
    
                       item.getIconResource = new AsyncForBitmap().execute(iconsrcVALUE).get();
                   }
    
                   if (parser.getName().equals(displayname)) {           
                       displaynameValue = parser.nextText();
    
                   }
                   break;
    
    0 讨论(0)
提交回复
热议问题