some1 post the code for accessing .txt file available in my res folder
the code for which can be written in .java file!!!
This is the LogCat output when i get that error!!
07-01 14:50:20.886: ERROR/AndroidRuntime(257): FATAL EXCEPTION: main
07-01 14:50:20.886: ERROR/AndroidRuntime(257): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{de.vogella.android.test/de.vogella.android.test.test}: java.lang.NullPointerException
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at android.os.Looper.loop(Looper.java:123)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at java.lang.reflect.Method.invoke(Method.java:521)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at dalvik.system.NativeStart.main(Native Method)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): Caused by: java.lang.NullPointerException
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at de.vogella.android.test.test.(test.java:55)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at java.lang.Class.newInstanceImpl(Native Method)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at java.lang.Class.newInstance(Class.java:1429)
07-01 14:50:20.886: ERROR/AndroidRuntime(257): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
You can put the file in your assets folder and then open it to read like you would in any other Java program.
Example here.