AsyncTask causes a fatal error while executing the InBackground () method [closed]

3

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();
        }
    }

}
    
asked by anonymous 31.05.2015 / 13:27

1 answer

-1

Everyone, find the error.

I had a library that I referred to, but the jar file was not in the bin folder. When the project was compiled the library was not packaged in apk. Dai gave the error.

Solution: was copied in the large hand the file to the bin folder and give a refresh on it and then a clear and refresh on the whole project.

Thanks!

    
01.06.2015 / 02:02