title: where should place the excel sheet when reading it to android application
body: <p>I'm trying to read data from excel sheet to android application in android studio 1.0.1. I referred <a href="http://www.cuelogic.com/blog/creatingreading-an-excel-file-in-android/" rel="nofollow">http://www.cuelogic.com/blog/creatingreading-an-excel-file-in-android/</a> to do this.This is my code snippet;</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public class MainActivity extends ActionBarActivity implements View.OnClickListener {
  
      Button readExcelButton;
  
      static String TAG = "ExelLog";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          readExcelButton = (Button) findViewById(R.id.readExcel);
          readExcelButton.setOnClickListener((android.view.View.OnClickListener) this);
      }
  
  
      private static void readExcelFile(Context context, String filename) {
  
          if (!isExternalStorageAvailable() || isExternalStorageReadOnly())
          {
              Log.e(TAG, "Storage not available or read only");
              return;
          }
  
          try{
              // ***I think this is the place to correct***
              File sdcard = Environment.getExternalStorageDirectory();
              File file = new File(sdcard,filename);
             // File file = new File(context.getExternalFilesDir(null), filename);
              FileInputStream myInput = new FileInputStream(file);
  
              // Create a POIFSFileSystem object
              POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput);
  
              // Create a workbook using the File System
              HSSFWorkbook myWorkBook = new HSSFWorkbook(myFileSystem);
  
              // Get the first sheet from workbook
              HSSFSheet mySheet = myWorkBook.getSheetAt(0);
  
              /** We now need something to iterate through the cells.**/
              Iterator rowIter = mySheet.rowIterator();
  
              while(rowIter.hasNext()){
                  HSSFRow myRow = (HSSFRow) rowIter.next();
                  Iterator cellIter = myRow.cellIterator();
                  while(cellIter.hasNext()){
                      HSSFCell myCell = (HSSFCell) cellIter.next();
                      Log.d(TAG, "Cell Value: " +  myCell.toString());
                      Toast.makeText(context, "cell Value: " + myCell.toString(), Toast.LENGTH_SHORT).show();
                  }
              }
          }catch (Exception e){
              e.printStackTrace();
          }
  
          return;
      }
  
      
     
  
      @Override
      public void onClick(View v) {
          switch (v.getId())
          {
              case R.id.readExcel:
                  readExcelFile(this,"test.xls");
                  break;
          }
      }
  
      public static boolean isExternalStorageReadOnly() {
          String extStorageState = Environment.getExternalStorageState();
          if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(extStorageState)) {
              return true;
          }
          return false;
      }
  
      public static boolean isExternalStorageAvailable() {
          String extStorageState = Environment.getExternalStorageState();
          if (Environment.MEDIA_MOUNTED.equals(extStorageState)) {
              return true;
          }
          return false;
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is the thing I want to do. I want to add excel sheet to my mobile device and (some where like in sdCard). When I run this this is the output on logcat after clicking the button<br></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>03-07 21:40:40.620  12484-12484/com.example.t_buddhika.csv W/System.err﹕ java.io.FileNotFoundException: /storage/sdcard0/test.xls: open failed: ENOENT (No such file or directory)
  03-07 21:40:40.620  12484-12484/com.example.t_buddhika.csv W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:427)
  03-07 21:40:40.620  12484-12484/com.example.t_buddhika.csv W/System.err﹕ at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:78)
  ....
  03-07 21:40:40.630  12484-12484/com.example.t_buddhika.csv W/System.err﹕ ... 14 more</code></pre>
  </div>
  </div>
  </p>
  
  <p>So how could I do that? How should I change the code and where should I put excel sheet? Help me on this.</p>