title: File not found exception? (Voice recog)
body: <p>Sorry for the long question, I have been stuck on this for a month, and I want to provide as much detail as possible...its just a file not found exception in a simple library... :)</p>
  
  <p><strong>I am getting a file not found exception on my <code>variances</code> file:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/wynuW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wynuW.jpg" alt="enter image description here"></a></p>
  
  <p>I do, however, have the variances file:</p>
  
  <p><a href="https://i.stack.imgur.com/cmYdl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cmYdl.png" alt="enter image description here"></a></p>
  
  <p>I am trying to simply implement voice recognition in my background service, so that I can detect when the user says the word hello (using pocketsphinx). </p>
  
  <p>The problem happens in this method: <code>createSphinxDir();</code></p>
  
  <p><strong>Here is my service:</strong></p>
  
  <pre><code> @Override
      public void onCreate() {
          super.onCreate();
         setupRecog();
  
          }
       private void setupRecog() {
      String sphinxDir = createSphinxDir();
      Log.v(TAG, "ABOUT TO CREATE SETUP");
      if (sphinxDir != null) {
          try {
  
              Log.v(TAG, "SETTING UP! :)");
              mSpeechRecognizer = defaultSetup()
                      .setAcousticModel(new File(sphinxDir, "en-us-ptm"))
                      .setDictionary(new File(sphinxDir, "hello.dict"))
                      .setBoolean("-allphone_ci", true) //WHAT IS THIS
                      .getRecognizer();
              mSpeechRecognizer.addListener(this);
  
              Log.v(TAG, "ADDED LISTENER");
  
              if ((new File(sphinxDir + File.separator + "command.gram")).isFile()) {
                  mSpeechRecognizer.addKeywordSearch("hello",
                          new File(sphinxDir + File.separator + "command.gram"));
  
                  Log.v(TAG, "ADDED KEYWORD SEARCH! :)");
              }
  
              // Or wherever appropriate
              mSpeechRecognizer.startListening("wakeup"); //Is this correct?
              Log.v(TAG, "STARTED LISTENING");
  
          } catch (IOException e) {
  
              Log.v("ERROR", TAG);
  
          }
      }
  }
  
  
  String createSphinxDir() {
      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
      String sphinxDir = prefs.getString("sphinx", null);
      if (sphinxDir == null) {
          Assets assets;
          Log.v(TAG, "Assets are not synced, should sync now:");
          try {
              Log.v(TAG, "In try block!");
              assets = new Assets(this);
              File sphinxDirFile = assets.syncAssets();
              Log.v(TAG, "Syncing assets...should set up listener");
              if (sphinxDirFile != null) {
                  sphinxDir = sphinxDirFile.getAbsolutePath();
                  SharedPreferences.Editor editor = prefs.edit();
                  editor.putString("sphinx", sphinxDir);
                  editor.commit();
                  Log.v(TAG, "Set up listener");
  
              }else{
                  Log.v(TAG, "sphinxDirFile is null!");
              }
          } catch (IOException e) { //THIS IS THE PLACE WHERE I AM GETTING THE ERROR!
              e.printStackTrace();
              Log.d(TAG, e.toString());
          }
      }
      return sphinxDir;
  }
  </code></pre>
  
  <p>I also have all the call back methods (onPartialResult, onResult, etc.) but they never get called.</p>
  
  <p><strong>Earlier I was getting an exception saying the variances .md5 file didn't exist, so I put a space in between the <code>variances</code> and the <code>.md5</code>, but now I am getting this error, and I don't know why...</strong></p>
  
  <p>Please let me know,</p>
  
  <p>Ruchir</p>