Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

stopSelf is not working

@Override public int onStartCommand(Intent intent, int flags, int startId) {

    int hour = MainActivity.sa3a;
    int minute = MainActivity.dakika;
    java.text.DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    Date date = new Date();
    System.out.println(dateFormat.format(date));
    int x = date.getHours();
    int y = date.getMinutes();
    String n = String.valueOf(x);
    Toast.makeText(send.this,n, Toast.LENGTH_SHORT).show();
    if (hour == x && minute == y) {
        Toast.makeText(send.this, "start", Toast.LENGTH_SHORT).show();
        this.stopSelf();
        Toast.makeText(send.this, "stop_Self_is_Not_work", Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(send.this, "yOKKKKKK", Toast.LENGTH_LONG).show();
    }

    return START_STICKY;
}

can you help me in this code .... thanks