-3

as new to android and had a requirement to start voice recording for specific period of time and the time will get by the button click by the user choice i had design the UI with several button with some second of time.so while clicking the button the time will set and recording will start.Is anything is there in android.Little help will be much appreciate.

blackjack
  • 586
  • 2
  • 11
  • 30

1 Answers1

1

Edit

If I didn't misread it again, take a look at TimerTask. After creating your recorder instance, run below code

new Timer().schedule(new TimerTask() {

            @Override
            public void run() {
                runOnUiThread(new Runnable() {

                    @Override
                    public void run() 
                    {
                        recorder.stop();
                        recorder.reset();
                        recorder.release();
                    }
                });

            }
}, longDelayInMilliseconds);

Answer Before Edit

I think AlarmManager is what you are looking for. As it says in the overview

allow you to schedule your application to be run at some point in the future

Take a look at these threads and blog entry.

Start app at a specific time

Android: How to use AlarmManager

Schedule app to start later

Community
  • 1
  • 1
mamba4ever
  • 2,662
  • 4
  • 28
  • 46
  • nothing to do with alarmmanager but to stop the recording after given period of time.Anyways found something in stacktrace and thank you for replies it will be helpfull may in future – blackjack Feb 02 '13 at 07:56
  • Thanks for notifying me. It seems I misunderstood your question, I edited my answer. – mamba4ever Feb 02 '13 at 09:26