I found the code for storing audio in .wav format from this link.The code has two buttons to start and stop the recording.I want to stop the audio recording after sometime.It uses the AudioRecord class of Android to store audio.Is it possible to do so?
04-19 08:20:00.688: E/AndroidRuntime(2405): FATAL EXCEPTION: main
04-19 08:20:00.688: E/AndroidRuntime(2405): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.androidwaverecorder/com.example.androidwaverecorder.MainActivity}: java.lang.NullPointerException
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.os.Looper.loop(Looper.java:137)
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.app.ActivityThread.main(ActivityThread.java:5039)
04-19 08:20:00.688: E/AndroidRuntime(2405): at java.lang.reflect.Method.invokeNative(Native Method)
04-19 08:20:00.688: E/AndroidRuntime(2405): at java.lang.reflect.Method.invoke(Method.java:511)
04-19 08:20:00.688: E/AndroidRuntime(2405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-19 08:20:00.688: E/AndroidRuntime(2405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-19 08:20:00.688: E/AndroidRuntime(2405): at dalvik.system.NativeStart.main(Native Method)
04-19 08:20:00.688: E/AndroidRuntime(2405): Caused by: java.lang.NullPointerException
04-19 08:20:00.688: E/AndroidRuntime(2405): at com.example.androidwaverecorder.MainActivity.onCreate(MainActivity.java:47)
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.app.Activity.performCreate(Activity.java:5104)
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
04-19 08:20:00.688: E/AndroidRuntime(2405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
04-19 08:20:00.688: E/AndroidRuntime(2405): ... 11 more
04-19 08:31:55.766: E/Trace(2899): error opening trace file: No such file or directory (2)
04-19 08:31:55.766: W/Trace(2899): Unexpected value from nativeGetEnabledTags: 0
04-19 08:31:55.766: W/Trace(2899): Unexpected value from nativeGetEnabledTags: 0
04-19 08:31:55.766: W/Trace(2899): Unexpected value from nativeGetEnabledTags: 0
04-19 08:31:56.386: W/Trace(2899): Unexpected value from nativeGetEnabledTags: 0
04-19 08:31:56.386: W/Trace(2899): Unexpected value from nativeGetEnabledTags: 0
04-19 08:31:56.416: W/Trace(2899): Unexpected value from nativeGetEnabledTags: 0
04-19 08:31:56.416: W/Trace(2899): Unexpected value from nativeGetEnabledTags: 0