The code does not display any errors, however when I run it, it stops and displays a Fatal Run-time error in the AsyncLoadXMLFeed class that extends AsyncTask.
Follow the AsyncLoadXMLFeed class code inside SplashActivity
public class AsyncLoadXMLFeed extends AsyncTask<Void, Void, Void> {
public AsyncLoadXMLFeed() {
}
@Override
protected Void doInBackground(Void... params) {
//Obtem o feed
DOMParser myParser = new DOMParser();
feed = myParser.parseXml(RSSFEEDURL);
if(feed != null && feed.getItemCount() > 0)
WriteFeed(feed);
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
startLisActivity(feed);
}
}
private void WriteFeed(RSSFeed data) {
FileOutputStream fOut = null;
ObjectOutputStream osw = null;
try {
fOut = openFileOutput(fileName, MODE_PRIVATE);
osw = new ObjectOutputStream(fOut);
osw.writeObject(data);
osw.flush();
} catch (Exception e) {
e.printStackTrace();
}
finally{
try {
fOut.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}