title: Error trying to open resource file in Android
body: <p>I'm newbie programming in Android with Java (really i'm new programming in Java).</p>
  
  <p>This is my problem: I'm trying to open a resource file of my project from the source code located at "src/main/res/raw/data.dat". This is my current code:</p>
  
  <pre><code>    try
          {
          DataInputStream stm = new DataInputStream(this.getAssets().open("res/raw/data.dat"));
          Log.d("out",String.valueOf(stm.readUnsignedShort()));
          Log.d("out",String.valueOf(stm.readInt()));
  
          stm.close();
  
      }catch (Exception ex)
      {
          ex.printStackTrace();
      }
  </code></pre>
  
  <p>Also, I tried to call to method this.getAssets().open() with "raw/data.dat", "data.dat", "src/main/res/raw/data.dat" and "main/res/raw/data.dat" and always return the same error:</p>
  
  <pre><code>01-23 22:40:40.719  13233-13233/com.rsoft.remotesystem W/System.err﹕ java.io.FileNotFoundException: &lt;file&gt;
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.content.res.AssetManager.openAsset(Native Method)
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.content.res.AssetManager.open(AssetManager.java:316)
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.content.res.AssetManager.open(AssetManager.java:290)
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at com.rsoft.remotesystem.MainActivity.connect(MainActivity.java:50)
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:525)
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.view.View$1.onClick(View.java:3833)
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.view.View.performClick(View.java:4475)
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.view.View$PerformClick.run(View.java:18786)
  01-23 22:40:40.729  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:730)
  01-23 22:40:40.739  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:92)
  01-23 22:40:40.739  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.os.Looper.loop(Looper.java:137)
  01-23 22:40:40.739  13233-13233/com.rsoft.remotesystem W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5419)
  01-23 22:40:40.739  13233-13233/com.rsoft.remotesystem W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
  01-23 22:40:40.739  13233-13233/com.rsoft.remotesystem W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:525)
  01-23 22:40:40.739  13233-13233/com.rsoft.remotesystem W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
  01-23 22:40:40.739  13233-13233/com.rsoft.remotesystem W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
  01-23 22:40:40.739  13233-13233/com.rsoft.remotesystem W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>What should I do?</p>