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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:49:18+00:00 2026-05-30T19:49:18+00:00

I am working with an application by using Service class to run the app

  • 0

I am working with an application by using Service class to run the app at back ground on every time.The service class will run at back ground.In my service class i have used a Time for run my at back ground on every time.In this case i am not getting an error in my emulator but if i run my app real device i am getting FATAL EXCEPTION Timer-0 error.

I have implemented my application as follows:

 public class RepeatService extends Service
 {
 ArrayList<ShoutMessage> resultMessage;
 private Timer timer = new Timer();
 private static final long UPDATE_INTERVAL = 30000;
 @Override
public IBinder onBind(Intent arg0) {
    return null;
}

@Override
public void onCreate() {

    pollForUpdates();
    super.onCreate();
}  

 private void pollForUpdates() {
    timer.scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {


            resultShoutMessage = new ParseXml().convertMessages(new Model().getMessages(getID));

            for(int i=0;i<resultMessage.size();i++)
            {
                String userID = resultMessage.get(i).getUserID();
                String userName = resultMessage.get(i).getUserFirstName();
                String messageID= resultMessage.get(i).getMessageID();
                String userMessage=resultMessage.get(i).getMessageText();


            }

                intent.setAction("com.sample.presentationLayer");
                sendBroadcast(intent); // finally broadcast
        }
    }, 0, UPDATE_INTERVAL);

}


 @Override
public void onDestroy() {
    timer.cancel();

    super.onDestroy();
}

}

When i run the above implementation i am getting an error as follows:

 01-01 01:18:34.414: ERROR/AndroidRuntime(2049): FATAL EXCEPTION: Timer-0
 01-01 01:18:34.414: ERROR/AndroidRuntime(2049): java.lang.NullPointerException
 01-01 01:18:34.414: ERROR/AndroidRuntime(2049):     at com.fitzgerald.presentationLayer.RepeatService$1.run(RepeatService.java:63)
01-01 01:18:34.414: ERROR/AndroidRuntime(2049):     at java.util.Timer$TimerImpl.run(Timer.java:289)

How can i resolve the above issue in my application?

please any body help me

  • 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-05-30T19:49:20+00:00Added an answer on May 30, 2026 at 7:49 pm

    Instead its a NullPointerException in your RepeatService.java at line number 63 inside run(). Just resolve it.

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

Sidebar

Related Questions

I'm working with an n-Tier application using WinForm and WCF Engine Service (Windows Service)
I'm currently working on web application using VB in ASP.NET. Right now I have
Greetings, I'm working in windows application using C#. I have typed-dataset called packetsDBDataSet and
I'm working on an asp.net MVC application. I have a class that wraps a
We are currently working on an application that will use a WCF service. The
I have successfully created a Python Windows service using pywin32. In testing my application
I have just written a program to run as a Windows Service Application, GasMeterMonitoring;
I am working a sample application using Windows Azure table storage. I will try
I am working on an application where i am using a wcf service. I
I am working on window application using c# . i want to show my

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.