Skip to content Skip to sidebar Skip to footer

How To Stop Alarm Android Application

I've to develop an application that remindes the user every 10 minutes with alertDialog during 2 hours ONLY, I made an application that reminds a user for each 10 minutes, but I wa

Solution 1:

Try this-

final Button bCancel= (Button) findViewById(R.id.button1);
bCancel.setOnClickListener(newOnClickListener() {

            @OverridepublicvoidonClick(View v) {

                //Your code to stop the alarm goes here.

            }
        });

newHandler().postDelayed(newRunnable() {

            @Overridepublicvoidrun() {
                bCancel.performClick();
            }
        }, (2*60*60*1000));

Solution 2:

You can create another alarm that will cancel your main alarm after 2 hours. This looks like the simplest solution.

Post a Comment for "How To Stop Alarm Android Application"