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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:46:21+00:00 2026-05-28T00:46:21+00:00

I have service and a mapActivity. I wish to update mapview outfrom serivce (draw

  • 0

I have service and a mapActivity.
I wish to update mapview outfrom serivce (draw new oerlays lets say each 15 sec.)
I get error:
can’t create handler inside thread that has not called looper.prepare();

my code:

private void startService() { 

     timer.scheduleAtFixedRate( new TimerTask() { 

    public void run() { 
    MyMap map = new MyMap(); // here is where app crashes...}

}    
}
  • 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-28T00:46:22+00:00Added an answer on May 28, 2026 at 12:46 am

    You can’t have UI code in a background service. Anything running in a service runs on a background thread rather than on the app’s UI thread, meaning that you cannot make UI changes from there. That’s why you get the error.

    If you sit back and think about it, architecturally there is no reason to have UI code in a background service. Drawing the map is a purely foreground operation and ceases to matter as soon as the map activity is dismissed. Hence no need to have background code stick around in a service — all the overlay code belongs in the foreground map activity.

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

Sidebar

Related Questions

In ViewPagerAdapter.class I have 2 layout(whereami.xml and mapview.xml), and use LayoutInflater to inflate each
Somewhat new to android, need some help with services. I have a service which
Hello have to start a new Activity from the BroascastReceiver or the Service, but
I have on Service that must communicate with an Activity (MyActivity) through a BradcastReceiver.
I have service url : please check it , It's return json string. I
I currently have service classes that look something like this public class UserService :
I have some problem with calling web service from flex. I have service with
I have web service, which use integrated security in IIS. Now, I want to
I have a service, as follows: The most basic (working) CherryPy 3.1 Windows service
We have a service hosted behind our firewall that receives request forwarded through to

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.