title: Can't check if file on sdcard exists
body: <p>I'm trying to make a simple check if the file exist. I saw similar questions here, but they didn't help. When I run my application, the app crashes and I got message "Unfortunatelly, fileCheck1 has stopped". I got this error both on emulator and smartphone.</p>
  
  <p>My code:</p>
  
  <pre><code>package com.example.fileCheck1;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.os.Environment;
  import android.widget.TextView;
  
  import java.io.File;
  
  public class MyActivity extends Activity {
  
      TextView msgText;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          msgText = (TextView) findViewById(R.id.textView);
          String Path = Environment.getExternalStorageDirectory().getPath()+"/ping.xml";
          File file = getBaseContext().getFileStreamPath(Path);
          if(file.exists()){
              msgText.setText("Found");
          }
          if(!file.exists()){
              msgText.setText("Not Found");
          }
      }
  }
  </code></pre>
  
  <p>In my Manifest such permissions:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"&gt;&lt;/uses-permission&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>