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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:31:42+00:00 2026-06-11T05:31:42+00:00

Lately, I’ve encountered more and more errors that may seem easy to someone with

  • 0

Lately, I’ve encountered more and more errors that may seem easy to someone with more experience, but are quite hard for me to figure out.

I’m trying to create a background service that checks for new feed entries each X minutes. Hence, I’m starting a loop from a service, and that loop creates an asynctask.

It works like a charm on my 4.1 phone, but on my 2.3 emulator it gives the following force close:

09-11 19:53:35.905: E/AndroidRuntime(354): FATAL EXCEPTION: AppConstructorPushLoop
09-11 19:53:35.905: E/AndroidRuntime(354): java.lang.ExceptionInInitializerError
09-11 19:53:35.905: E/AndroidRuntime(354):  at com.appconstructor.actest.PushNotificationService$1.run(PushNotificationService.java:54)
09-11 19:53:35.905: E/AndroidRuntime(354):  at java.util.Timer$TimerImpl.run(Timer.java:284)
09-11 19:53:35.905: E/AndroidRuntime(354): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
09-11 19:53:35.905: E/AndroidRuntime(354):  at android.os.Handler.<init>(Handler.java:121)
09-11 19:53:35.905: E/AndroidRuntime(354):  at android.os.AsyncTask$InternalHandler.<init>(AsyncTask.java:421)
09-11 19:53:35.905: E/AndroidRuntime(354):  at android.os.AsyncTask$InternalHandler.<init>(AsyncTask.java:421)
09-11 19:53:35.905: E/AndroidRuntime(354):  at android.os.AsyncTask.<clinit>(AsyncTask.java:152)
09-11 19:53:35.905: E/AndroidRuntime(354):  ... 2 more

I realize this usually means I’m trying to do UI stuff in a non-UI thread, but this is not the case. In fact, even if I comment out ALL activity in the ASyncTask, it still forces close. It only stops force closing when I comment out the line starting the loop

This only happens on my 2.3 emulator, and is unrelated to the 4.0 style notification I’m using.

Would anyone know more about this?

Thanks!

edit -> If I call Looper.prepare() I get the error that that may happen only once per thread.

  • 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-11T05:31:43+00:00Added an answer on June 11, 2026 at 5:31 am

    you are updating the UI tread from the timer , if you simply put even a toast inside the timer it wont work because timer is not attach with UI thread and you can’t prepare the thread two times cause when you call thread.execute it already prepare and in 4.1 its handling by android OS itself. AsyncTask can only call from UI thread.

    new refreshList().execute();
    

    run your this code inside runOnUiThread(action) and dont forget to cancel the Thread before executing a new one.

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

Sidebar

Related Questions

Lately, I've gotten some weird linker errors. I've been taught that there's two ways
Lately I bumped repeatedly into the concept of LFSR, that I find quite interesting
Lately I have become a huge fan of XSL, XPath and XML, but I've
Lately I've been working on stored procedure and encountered 1 strange problem. First, I
lately I am more a user of the Scala Programming Language than C++, And
Lately I was pointed to http://opencpu.org/ . Nifty website, but after browsing for a
Lately I had an issue with an array that contained some hundred thousands of
Lately I've been wondering if there's a difference between initializing the variables that have
Lately I have been having more and more issues with the content assist in
Lately I have started to put more and more functions into header files, mostly

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.