title: Android access raw file inside class without Context (non- Activity)
body: <p>I have a code inside myActivity.class</p>
  
  <pre><code>InputStream inputStream = getApplicationContext().getResources().openRawResource(R.raw.text);
  BufferedReader buff = new BufferedReader(new InputStreamReader(inputStream));
  String s;
  ArrayList &lt;String&gt; list = new ArrayList &lt;String&gt;();
  try    
  {  while((s = buff.readLine()) != null)
         {
             list.add(s);
         }
  
  } catch (IOException e) {
             e.printStackTrace();
  } finally {
          try {
              in.close();
          } catch (IOException e) {
              e.printStackTrace();
          }
  }
  </code></pre>
  
  <p>I want to move that part of code to separate java.class, but here I face a problem, how I can to access a raw file by InputStream without using getApplicationContext()?</p>
  
  <p>For instance:</p>
  
  <pre><code>public class MyArrayList extends ArrayList&lt;String&gt;
  {
  
  private InputStream in = ???; // how to declare InpuStream without Context???
  private BufferedReader buff = new BufferedReader(new InputStreamReader(in));;
  private String s;
  private MyArrayList array;
  
  public MyArrayList ()
  {
      try
      {
          while ((s = buff.readLine()) != null)
            {
              array.add(s);
            }
  
      } catch (IOException e)
      {
          e.printStackTrace();
      } finally
      {
          try {
              in.close();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  
  }
  </code></pre>
  
  <p>I have tried
       <code>InputStream in = Resources.getSystem().openRawResource(R.raw.text);</code> but it gave me NullPointerException</p>
  
  <p>So my question is: Does exist some way to initialize InputStream with raw file outside Activity ?</p>