3
The code does not present any error, but when I run it stops and presents a Fatal error at runtime in the Asyncloadxmlfeed class extending from Asynctask.
follows the class code Asyncloadxmlfeed that is 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();
}
}
}
Just saying it’s wrong and not saying what it is Doesn’t help who might want to help you.
– ramaral
Agree with @ramaral, it would be good to take a look at the logcat to see if there is no stacktrace of the error that occurred.
– Wakim