title: Android: Howto get a resource id of an android resource
body: <p>I want to get a resource id of an android resource that I have saved in /res/raw folder. </p>
  
  <p>The use - </p>
  
  <p>1) I am passing the name of the resource to the class and this name is being saved in a string fileNeme.</p>
  
  <p>2) The statement for getting this file is <code>this.getResources().openRawResource(R.raw.xyz)</code> where xyz is the actual filename. </p>
  
  <p>3) I understand that openRawResource(int) method takes an int value hence I cannot use the statement as <code>this.getResources().openRawResource(R.raw.filename)</code> where filename is a string variable defined above. </p>
  
  <p>Problem: I know the filename which is saved in a string called filename but I cannot open it as the method takes the resource id in int format.</p>
  
  <p>I need to get the resource id of this filename and save it in an int variable filename_int and pass this variable to openRawResource method.</p>
  
  <p>Please let me know how can I achieve this. </p>