title: Reading from a Text file in Android Studio Java
body: <p>I have a class QuoteBank that needs to read in a txt file with scanner but it is giving me a file not found exception</p>
  
  <p>java file is at
  app/src/main/java/nate.marxBros/QuoteBank.java</p>
  
  <p>txt file is at
  app/src/main/assets/Quotes.txt</p>
  
  <p>the code is</p>
  
  <pre><code>File file = new File("assets/QuotesMonkeyBusiness.txt");
      Scanner input = null;
      try {
          input = new Scanner(file);
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>Shouldnt this work just like any other java program? but it gives file not found exception</p>
  
  <p>I've tried many things on this site like 
  <a href="https://stackoverflow.com/questions/26634463/android-studio-reading-from-raw-resource-text-file">Android Studio Reading from Raw Resource Text File</a>
  but that method does not work because i dont know how to pass in Context</p>
  
  <p>thanks for any help</p>
  
  <p>updated code</p>
  
  <pre><code>public class QuoteBank {
  private ArrayList&lt;ArrayList&lt;QuoteBank&gt;&gt; bank;
  private Context mContext;
  private ArrayList&lt;QuoteQuestion&gt; monkeyBuisness;
  
  
  public QuoteBank(Context context){
      mContext = context;
      InputStream is = null;
      try {
          is = mContext.getAssets().open("QuotesMonkeyBusiness.txt");
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      ArrayList&lt;QuoteQuestion&gt; monkeyBuisness = parseFileToBank(is);
  }
  </code></pre>
  
  <p>MainActivity</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  QuoteBank b = new QuoteBank(MainActivity.this);
  </code></pre>