NullPointerException in BufferedWriter
<p>The following method shows NullPointerException.  I can't understand what is wrong with below code.  Where the file stored in </p>

<pre><code>public class Mtx extends Activity  {
public void ConfWrite() {
    try {
     BufferedWriter buf = new BufferedWriter(new FileWriter(getFilesDir()+"\\file.java"));

        buf.write("Hello Android");
        buf.newLine();
        buf.close();

    } catch (Exception e) {
        e.printStackTrace();
    }
}   
</code></pre>

<p>}</p>

<p>stack trace output</p>

<pre><code>02-10 13:11:18.365: WARN/System.err(7179): java.lang.NullPointerException
02-10 13:11:18.396: WARN/System.err(7179):     at android.content.ContextWrapper.getFilesDir(ContextWrapper.java:178)
02-10 13:11:18.419: WARN/System.err(7179):     at mediatronix.HAT.Mtx.ConfWrite(Mtx.java:19)
02-10 13:11:18.425: WARN/System.err(7179):     at mediatronix.HAT.MainMenu.onCreate(MainMenu.java:46)
02-10 13:11:18.437: WARN/System.err(7179):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-10 13:11:18.485: WARN/System.err(7179):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-10 13:11:18.495: WARN/System.err(7179):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-10 13:11:18.505: WARN/System.err(7179):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-10 13:11:18.525: WARN/System.err(7179):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-10 13:11:18.545: WARN/System.err(7179):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-10 13:11:18.555: WARN/System.err(7179):     at android.os.Looper.loop(Looper.java:123)
02-10 13:11:18.585: WARN/System.err(7179):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-10 13:11:18.616: WARN/System.err(7179):     at java.lang.reflect.Method.invokeNative(Native Method)
02-10 13:11:18.625: WARN/System.err(7179):     at java.lang.reflect.Method.invoke(Method.java:521)
02-10 13:11:18.665: WARN/System.err(7179):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-10 13:11:18.675: WARN/System.err(7179):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-10 13:11:18.695: WARN/System.err(7179):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>thanks</p>
