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 8994115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:21:06+00:00 2026-06-15T23:21:06+00:00

My application turned black screen right after I initialize service in my activity. No

  • 0

My application turned black screen right after I initialize service in my activity. No error or warning message was shown. Awhile later the application is already not responding and even after the time limit the service did not update info to the server. I wanted to use the service to send user’s location constantly to the server after every minute. Service is initialize in my activity. I also included the service in AndroidManifest.xml as well.

LocationService
The code below is my structure of Service

public class LocationService extends Service{

@Override

public IBinder onBind(Intent arg0){
    return null;
}


private String TAG = "LocationService";


@Override
public void onCreate(){
    super.onCreate();
            boolean isUpdateResult = true;

    try{
        while(isUpdateResult){

             new CountDownTimer (60000, 1000) {



                 public void onTick(long millisUntilFinished) {

                 }

                 public void onFinish() {
                   //Send information to server                          

                }.start();
        }
    }
    finally{

    }
}

@Override
public void onDestroy(){
    super.onDestroy();
}
}

Below is how I call the service in my main activity.

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.display_screen);

    startService(new Intent(Web_Slider.this,
            LocationService.class));
    }

Any idea what causes the black screen? Did I missed out something here?
Any comments will be appreciated! Thank you in advance.

  • 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-15T23:21:08+00:00Added an answer on June 15, 2026 at 11:21 pm

    I managed to solve this. Apparently if I run new CountDownTimer (60000, 1000) in the beginning of the loop, the screen will turned into black screen. If not mistaken is due constantly create new CountDownTimer cause it unable to function as it should. The right way to put it is take away the While(isUpdateResult). The function will constantly start a count down timer because there is a .start(); after onFinish();. So there while loop is not needed.

             new CountDownTimer (60000, 1000) {
    
    
    
                 public void onTick(long millisUntilFinished) {
    
                 }
    
                 public void onFinish() {
                   //Send information to server                          
    
                }.start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have turned off the application.calculation = xlcalculationmanual and after such a lengthy vba
We have a web application that has custom errors turned on so that users
I run an nginx-powered application and I recently turned my attention to using it
I run an ASP.NET application on IIS 6.0. Usually I have compression turned on
I'm running single instance CloudFoundry configuration with one web application. I turned on Hyperic
When I used full screen in as3, application opens full screen, but it completely
I have developed one application which will have activities and one background service and
In my application, I get the screen resolution with this code: SystemInformation.PrimaryMonitorSize And I
I would like to achieve this: After first turning on the application, user receives
Application, have a TextBlock and two Buttons, the text is displayed TextBlock by clicking

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.