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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:39:08+00:00 2026-06-15T12:39:08+00:00

I am working on an android application.In my activity I am using the following

  • 0

I am working on an android application.In my activity I am using the following code.

LocationResult locationResult = new LocationResult(){

        @Override
        public void gotLocation(Location location){
            //Got the location!




            Drawable marker = getResources().getDrawable(
                    R.drawable.currentlocationmarker);//android.R.drawable.btn_star_big_on
            int markerWidth = marker.getIntrinsicWidth();
            int markerHeight = marker.getIntrinsicHeight();
            marker.setBounds(0, markerHeight, markerWidth, 0);
            MyItemizedOverlay myItemizedOverlay = new MyItemizedOverlay(marker);
            currentmarkerPoint = new GeoPoint((int) (location.getLatitude() * 1E6),
                    (int) (location.getLongitude() * 1E6));

            currLocation = location;

            mBlippcoordinate = currentmarkerPoint;
            mBlippLocation = location;
            myItemizedOverlay.addItem(currentmarkerPoint, "", "");

            mBlippmapview.getOverlays().add(myItemizedOverlay);
            animateToCurrentLocation(currentmarkerPoint);


        }
    };


    MyLocation myLocation = new MyLocation();
    myLocation.getLocation(this, locationResult);

I am using the above code to find location from gps or network .The animateToCurrentLocation(currentmarkerPoint); method contains a asynctask .So I am getting

java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

Thanks 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-15T12:39:09+00:00Added an answer on June 15, 2026 at 12:39 pm

    You get this error when you are trying to create and run an AsyncTask from a thread that has no Looper attached to it. The AsyncTasks needs a Looper to post its “task completed” message back on the thread that started the AsyncTask.

    Now your real question: how to get a thread with a Looper? It turns out you already have one: the main thread. As the documentation also states, you should create and .execute() your AsyncTask from the main thread. The doInBackground() will then run on a worker thread (from the AsyncTask threadpool) and you can access the network there. The onPostExecute() will then be run on you main thread, after it has been posted there via the main thread’s Handler/Looper.

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

Sidebar

Related Questions

I am using the following to mock my location in Android. public class GPSwork
i'm new with android. I'm working on an application using xml layouts. I wish
My application is Tab using ActivityGroup.I have done title of each activity using getParent().getParent().setTitle(New
I'm working on an android native application, and I'm using a Webview to load
I am working android application my problem is i am using handlers this handler
I'm working on an Android Application and I'm using the .setAdapter command and I'm
Am new to android, am developing application with websevices using json parsing with httpget
I'm working in an android mapping application using osmdroid mapping API, until now I'm
I've got an android application that I want to open a different activity then
I changed some code on an android application that was working perfectly fine at

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.