Problem in refering Files from Android emulator?
<p>I have one problem , i want to refer particular file in my system D: from my android emulator,but it throwing Nullpointer Exception, Here is my code</p>

<pre><code>for (File file : new File("D:\\vcards").listFiles())
        {
            i++;
        }
Log.i("I",""+i);
</code></pre>

<p>If i run this code in core java application it prints the no of files in the folder,but in android application it gives NUllpointer Exception</p>

<pre><code>02-08 10:10:09.653: WARN/System.err(439): java.lang.NullPointerException
02-08 10:10:09.653: WARN/System.err(439):  at payoda.android.Temp.onCreate(Temp.java:22)
02-08 10:10:09.664: WARN/System.err(439):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-08 10:10:09.664: WARN/System.err(439):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
02-08 10:10:09.674: WARN/System.err(439):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
02-08 10:10:09.674: WARN/System.err(439):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
02-08 10:10:09.674: WARN/System.err(439):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
02-08 10:10:09.684: WARN/System.err(439):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-08 10:10:09.684: WARN/System.err(439):  at android.os.Looper.loop(Looper.java:123)
02-08 10:10:09.694: WARN/System.err(439):  at android.app.ActivityThread.main(ActivityThread.java:4363)
02-08 10:10:09.694: WARN/System.err(439):  at java.lang.reflect.Method.invokeNative(Native Method)
02-08 10:10:09.694: WARN/System.err(439):  at java.lang.reflect.Method.invoke(Method.java:521)
02-08 10:10:09.704: WARN/System.err(439):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-08 10:10:09.704: WARN/System.err(439):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-08 10:10:09.713: WARN/System.err(439):  at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>I dont know how to how to get the no of file files in that folder through Android program.If anybody knows the answer please help me.</p>
