Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8759483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:49:09+00:00 2026-06-13T14:49:09+00:00

I have a service that places a red rectangle on the screen and has

  • 0

I have a service that places a red rectangle on the screen and has a onDestroy() that looks like this

@Override
    public void onDestroy() {

      Toast.makeText(this, "service done", Toast.LENGTH_SHORT).show(); 
}

from one of my activities i am calling to kill this service like so:

 stopService(new Intent(this, assNavOverrideService.class));

i see the toast come up saying that the onDestroy() has been called but i still see the red rectangle and it is still running..

my manifest is using :

<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" >

myService

public class assNavOverrideService extends Service {

    Timer timer;
    WindowManager.LayoutParams handleParams;

    View screenBlock;
    View disableStatusBar;
    WindowManager winMgr;
    @Override
    public void onCreate() {

        winMgr = (WindowManager)getSystemService(WINDOW_SERVICE); 
    }

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

        disableStatusBar = new TableLayout(getApplicationContext());
        handleParams = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.FILL_PARENT,
                50, 
                WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
                 // this is to keep button presses going to the background window
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
                WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
                 // this is to enable the notification to recieve touch events
                WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
                 // Draws over status bar
                WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
                PixelFormat.TRANSPARENT);

         handleParams.gravity = Gravity.TOP;
         handleParams.y = 750;

         disableStatusBar.setBackgroundResource(R.drawable.fake_nav);

         winMgr.addView(disableStatusBar, handleParams);

         timer = new Timer();
         uiCheckTask tTask = new uiCheckTask();
         tTask.setService(this);
         timer.schedule(tTask, 50, 10);

        // If we get killed, after returning from here, restart
         return START_REDELIVER_INTENT;
    }

    @Override
    public IBinder onBind(Intent intent) {
        // We don't provide binding, so return null
        return null;
    }

    @Override
    public void onDestroy() {

      Toast.makeText(this, "service done", Toast.LENGTH_SHORT).show(); 
    }



    class uiCheckTask extends TimerTask {
        Boolean secDialog = false;
        assNavOverrideService myService;


       public void setService(assNavOverrideService mS){
           myService = mS;
       }


        public void run() {

                Log.v("TICK","TOCKKKKKKKKKKK");


        }



    }



}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:49:11+00:00Added an answer on June 13, 2026 at 2:49 pm

    Solved, in my Service’s onDestroy() i had to stop the timer task and the service then closed…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a cart model class that has a List property like so: public
I have a service that use the tcp binding and this services allows to
I have a service that I would like it to become single instance, because
I have a service that has a dependency on SQL server express (2005). Every
I have a service with some entities that I would like to expose in
I have a WCF service that is called from various places I have a
I have a service interface that reads thus package services; import domain.Items; public interface
We have a plugin system on a WCF service that checks libraries placed in
I have a Service that sends an Intent to my Activity every 0.1 seconds.
I have a service that is downloading a file. When the download is done,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.