This is a program to get RSS on Android.
http://www.panzee.biz/archives/3255 The code is located on this site.
If things go on like this, I will not be able to retrieve them in the form of a Livedoor blog.
RSS is the
<link>
http://blog.livedoor.jp/------.html
</link>
<description/>
<dc:creator>aatyu</dc:creator>
<dc:date>2016-01-02T22:35:31 + 09:00</dc:date>
<dc:subject>Hard Industry</dc:subject>
The above format.The date acquisition part of the code below is
} else if(tag.equals("dc:date")){// Version by Date
I tried to change it to , but I couldn't get it.
tag.contains("date")
tag.equals(":date")
These didn't work either. (Results remain null)
// Parse XML
public RssListAdapter parseXml (InputStream is) threads IOException,
XMLPullParserException {
XmlPullParser parser=Xml.newPullParser();
try{
parser.setInput(is,null);
int eventType=parser.getEventType();
Item currentItem=null;
while(eventType!=XmlPullParser.END_DOCUMENT){
String tag = null;
switch(eventType){
caseXmlPullParser.START_TAG:
tag=parser.getName();
if(tag.equals("item"){
currentItem = newItem();
} else if (currentItem!=null) {
if(tag.equals("title"){
currentItem.setTitle(parser.nextText());
} else if(tag.equals("author"){
currentItem.setSite(parser.nextText()));
} else if(tag.equals("pubDate")}
currentItem.setDate(parser.nextText()));
}
// else if(tag.equals("description"){
// currentItem.setDescription(parser.nextText());
// }
}
break;
caseXmlPullParser.END_TAG:
tag=parser.getName();
if(tag.equals("item"){
mAdapter.add(currentItem);
}
break;
}
eventType=parser.next();
}
} catch(Exceptione){
e.printStackTrace();
}
return mAdapter;
}
} else if(tag.equals("date"){
I was able to get it in
© 2024 OneMinuteCode. All rights reserved.