title: How to use getFilesDir()?
body: <p>I am trying to get my app's root directory, but getting the following exception. I even defined my context. How do I fix this? I have been stuck on this since the past 3 hours.</p>
  
  <pre><code>   ContextWrapper c = new ContextWrapper(this);
     String FileDirectory =  c.getFilesDir().getPath();
  </code></pre>
  
  <p>exception:</p>
  
  <pre><code> Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File android.content.Context.getFilesDir()' on a null object reference
  </code></pre>
  
  <p>edit:  </p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  public static final int DIALOG_DOWNLOAD_PROGRESS = 0;
  private ProgressDialog mProgressDialog;
  
  ContextWrapper c = new ContextWrapper(this);
  
  File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
  String FileDirectory =  c.getFilesDir().getPath();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  </code></pre>