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

  • Home
  • SEARCH
  • 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 8067807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:27:17+00:00 2026-06-05T12:27:17+00:00

I am having trouble starting a Service . It crashes before the application even

  • 0

I am having trouble starting a Service. It crashes before the application even starts.

      Intent repSer = new Intent(this,repService.class);

      startService(repSer);

this is the Service itself.:

public class repService extends Service {
@Override
public void onCreate() {
    // TODO Auto-generated method stub
    super.onCreate();
    while(true){
        Thread timer = new Thread(){
            public void run(){
                try {
                    sleep(5000);
                    // do something

                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } finally {
                    // do something
                }
            }
        };
        timer.start();  
    }   
}
}

perhaps this is wrong?
my manifest entry:

    <service android:name = ".repService"/>  
  </application> 
  • 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-05T12:27:18+00:00Added an answer on June 5, 2026 at 12:27 pm

    You’re just constantly looping through the while and starting new Threads with timers inside. You’re probably overloading with Threads. As fast as the while() statement can loop you’re creating another Thread and starting it.

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

Sidebar

Related Questions

I'm new to SQL and I am having trouble even starting this query. If
I'm having trouble starting a Service to update an AppWidget that I'm creating as
I'm having trouble solving this problem. I have to find all simple paths starting
I'm having trouble stopping an animation before it's done. My code starting at line
I'm having an amazing amount of trouble starting and stopping a service on my
I'm just starting to learn intel assembly and I'm having trouble with this simple
I'm having trouble starting a transaction with Hibernate and MySQL while running in JUnit.
Just starting with Modelica and having trouble understanding how it works. In the below
I am just starting to learn a little about PHP; having trouble with the
I'm starting to understand git but I'm still having some trouble with the abstraction.

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.