getFilesDir() android function is undefined if i dont extend my class with activity
<p>If i have my class as </p>

<pre><code>import java.io.File;

import java.io.FileOutputStream;

//Extends Activity

public class MyClass extends Activity
{

File fileDir = getFilesDir(); //no error

   . ....    
}
</code></pre>

<p>But if i don't extend MyClass , i get an error saying "getFilesDir()" undefined.</p>

<p>some thing like </p>

<pre><code>   public class MyClass2
    {

    ....

    File fileDir = getFilesDir(); //error

    }
</code></pre>
