Open file in a class
<p>Howdy,
I currently have my main activity in Android. It's called start activity. 
My programm is designed so that it loads an XML File from the web, and parses it. </p>

<p>Now in future I want to add also the ability that the program loads the XML file and instead of parsing it every runtime it loads the data from an SQLLite database.</p>

<p>However for that I need to write an interface which capsulates the different functionalities.</p>

<p>In case that the XML needs to be used I wrote me a small class which should cover the XML loading - but I cannot use openFileInput(...) ... since that class is not an activity ( does it need to be one?? ).</p>

<pre><code>package com.android.mensa.handledata;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.TreeMap;

import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import android.app.Activity;

import com.android.mensa.datastructure.LunchPlace;
import com.android.mensa.getData.XMLHandler;
import com.android.mensa.interfaces.Data;

/**
 * This class implements the interface Data
 * and gathers the necessary informations out of the XML File on the actual device.
 */
public class XMLData implements Data{

    @Override
    public void getMenuforDay() {
        // TODO Auto-generated method stub

    }

    public TreeMap&lt;String, LunchPlace&gt; open()
    {
        File test = new File("lunchfile");
        FileInputStream fis;
        TreeMap&lt;String, LunchPlace&gt; places = new TreeMap&lt;String, LunchPlace&gt;();
        try {
            fis = openFileInput("lunchfile");
            XMLHandler xmlhandler = new XMLHandler();
            places  = xmlhandler.parse(fis);            
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        catch (SAXException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ParserConfigurationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return places;
    }
}
</code></pre>

<p>I guess my question is pretty basic: does the XMLhandler helper class ( which is supposed to return a TreeMap ) needs to be an activity or how else can I achieve my functionality?</p>
