私のアプリでは、50〜100個のデータが解析されます... 2 MBのサイズの画像もあります...これらはすべて1つのアクティビティに取得され、並べ替えられて表示されますそこに...Android SAX解析の取得が非常に遅い
しかし、それは約2分かかります...それはあまりにも。
解析時間を短縮するにはどうすればよいですか?
または私は間違っているあなたが本当にあなたのコードをプロファイリングし、それはだ場所を見つける必要がありますXmlHandler.java
public class XmlHandler extends DefaultHandler{
static GetXml getxml;
Boolean currentElement = false;
String currentValue = null;
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
// TODO Auto-generated method stub
currentElement=true;
if (localName.equals("root"))
{
/** Start */
getxml = new GetXml();
}
}
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
// TODO Auto-generated method stub
currentElement=false;
//**************************display page************************
if (localName.equalsIgnoreCase("DisplayId"))
getxml.setDisplayId(currentValue);
if (localName.equalsIgnoreCase("DisplayPage"))
getxml.setDisplayPage(currentValue);
//**************************category details************************
if (localName.equalsIgnoreCase("CategoryId"))
getxml.setCategoryId(currentValue);
if (localName.equalsIgnoreCase("CategoryName"))
getxml.setCategory(currentValue);
//**************************news details************************
if (localName.equalsIgnoreCase("Picture"))
getxml.setPictureName(currentValue);
if (localName.equalsIgnoreCase("newsHeading"))
getxml.setNewsHeading(currentValue);
if (localName.equalsIgnoreCase("Mainnews"))
getxml.setMainNews(currentValue);
}
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
// TODO Auto-generated method stub
if (currentElement) {
currentValue = new String(ch, start, length);
currentElement = false;
}
}
'あなたのクラスをXmlHandler'で、あなたは私たちにそのコードを表示することができますか? –
@DonRobyコードを確認する – subrussn90