title: Where to save text file to be able to read it into Android project
body: <p>I have looked around to find out where to save general text files for reading into my Android project, but couldn't find a definite answer. When I save my "foo.txt" file into my res/raw folder as someone suggested (I had to create the raw folder) the R.java file gets error for these lines:</p>
  
  <pre><code>public static final class raw {
      public static final int 1_1=0x7f050000;
  }
  </code></pre>
  
  <p>This is because my file contains the string "1_1" on the first line, which I want it to have. Where in the folder structure should I put my file to be able to read it? The file is not created from Android but manually by me.</p>
  
  <p>Could someone also please advise on how to read a file in the following format? I want to be able to read the Strings and numbers one by one and insert into java variables in my Android project. Is it best to separate with commas or spaces?</p>
  
  <pre><code>1_1
  String
  Int
  Int String String Int Int Float Float Int Int
  Int String String Int Int Float Float Int Int
  Int String String Int Int Float Float Int Int
  Int String String Int Int Float Float Int Int
  Int String String Int Int Float Float Int Int
  Int String String Int Int Float Float Int Int
  </code></pre>
  
  <p><strong>Updated with more code:</strong></p>
  
  <pre><code>package com.my.package;
  
  import java.io.File;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.ImageButton;
  import android.widget.TextView;
  import android.widget.Toast;
  
  //public class GameActivity extends FragmentActivity implements OnClickListener {
  public class GameActivity extends Activity implements OnClickListener{  
  
  private ImageButton leftPauseButton;
  private ImageButton rightPauseButton;
  
  private ImageButton leftButton1;
  private ImageButton leftButton2;
  private ImageButton leftButton3;
  
  private ImageButton rightButton1;
  private ImageButton rightButton2;
  private ImageButton rightButton3;
  
  
    public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.testlayout);
          TextView txtView = (TextView) (findViewById(R.id.testID_canBeRemoved));
  
              //Did not work
          //int resourceId = this.getResources().getIdentifier("com.my.package:raw/foo.txt", null, null);
          //File f = new File("com.my.package:raw/foo.txt");
  
              //Does not work - file.exists() returns a zero value
          File file = new File("assets/foo.txt");
  
          if ( file.exists() ){
              txtView.setText("Exists");
          }
          else{
              txtView.setText("Does not exist");
          }
  
  
  //          InitiateUIComponents();
  
      }
  
          //This is for using another xml layout
      private void InitiateUIComponents(){
  
          leftPauseButton = (ImageButton) (findViewById(R.id.leftPauseButtonID));
          rightPauseButton = (ImageButton) (findViewById(R.id.rightPauseButtonID));
  
          leftButton1 = (ImageButton) (findViewById(R.id.leftMenuButton1ID));
          leftButton2 = (ImageButton) (findViewById(R.id.leftMenuButton2ID));
          leftButton3 = (ImageButton) (findViewById(R.id.leftMenuButton3ID));
  
          rightButton1 = (ImageButton) (findViewById(R.id.rightMenuButton1ID));
          rightButton2 = (ImageButton) (findViewById(R.id.rightMenuButton2ID));
          rightButton3 = (ImageButton) (findViewById(R.id.rightMenuButton3ID));
  
          leftPauseButton.setOnClickListener(this);
          rightPauseButton.setOnClickListener(this);
  
          leftButton1.setOnClickListener(this);
          leftButton2.setOnClickListener(this);
          leftButton3.setOnClickListener(this);
  
          rightButton1.setOnClickListener(this);
          rightButton2.setOnClickListener(this);
          rightButton3.setOnClickListener(this);
  
      }
  
              //This is for using another xml layout
      @Override
      public void onClick(View v) {
  
          switch (v.getId()) {
          case R.id.leftPauseButtonID:
              Toast.makeText(this, "Left pause button clicked!", Toast.LENGTH_SHORT).show();
              break;
          case R.id.rightPauseButtonID:
              Toast.makeText(this, "Right pause button clicked!", Toast.LENGTH_SHORT).show();
              break;
          case R.id.leftMenuButton1ID:
              Toast.makeText(this, "Left menu button 1 clicked!", Toast.LENGTH_SHORT).show();
              break;
          case R.id.leftMenuButton2ID:
              Toast.makeText(this, "Left menu button 2 clicked!", Toast.LENGTH_SHORT).show();
              break;
          case R.id.leftMenuButton3ID:
              Toast.makeText(this, "Left menu button 3 clicked!", Toast.LENGTH_SHORT).show();
              break;
          case R.id.rightMenuButton1ID:
              Toast.makeText(this, "Right menu button 1 clicked!", Toast.LENGTH_SHORT).show();
              break;
          case R.id.rightMenuButton2ID:
              Toast.makeText(this, "Right menu button 2 clicked!", Toast.LENGTH_SHORT).show();
              break;
          case R.id.rightMenuButton3ID:
              Toast.makeText(this, "Right menu button 3 clicked!", Toast.LENGTH_SHORT).show();
              break;
  
  
          default:
              break;
          }
  
      }
  
  }
  </code></pre>
  
  <p>And here is the xml file for this test:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  &gt;
  
  &lt;TextView 
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:id="@+id/testID_canBeRemoved"
      android:text="Blabla"
  &gt;
  
  &lt;/TextView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>