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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:42:06+00:00 2026-05-25T13:42:06+00:00

I have an async method which puts markers on a Google Map View. In

  • 0

I have an async method which puts markers on a Google Map View. In the code below I am trying to pass the object overlayitem into the method onProgressUpdate. I am getting a compiler error that the itemizedOverlay.addOverlay is not expecting an array. I am confused why overlayitem is being passed in as an array (i.e overlayitem[]). Can anyone help ?

  class OverlayLoader extends AsyncTask<Void, OverlayItem, Void> {
    List<Overlay> mapOverlays;

    @Override
    protected void onPreExecute() {
        mapOverlays = mapView.getOverlays();
    }

    @Override
    protected Void doInBackground(Void... params) {
        SQLiteDatabase db = mDbHelper.getReadableDatabase();

        Cursor mCursor = db.query(TABLE_NAME, null, null, null, null, null, null);

        startManagingCursor(mCursor);

        OverlayItem overlayitem = null;

        while (mCursor.moveToNext()) {

            Address = mCursor.getString(4);
            Name = mCursor.getString(0);

            String noSpaces = Address.replaceAll(" ", "+");

            JSONObject geocoded = getLocationInfo(noSpaces);
            GeoPoint point = getGeoPoint(geocoded);

            overlayitem = new OverlayItem(point, Name, Address);

            publishProgress(overlayitem);
        }
        return null;
        }

    protected void onProgressUpdate(OverlayItem... overlayitem) {
        List<Overlay> mapOverlays = mapView.getOverlays();
        String x = "@Hello";
        Log.e("Hello",""+x);
        Drawable drawable = maptabview.this.getResources().getDrawable(R.drawable.pushpin);
        CustomizedItemOverlay itemizedOverlay = 
            new CustomizedItemOverlay(drawable, maptabview.this);   

        itemizedOverlay.addOverlay(overlayitem); 
        mapOverlays.add(itemizedOverlay);
    }
}
  • 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-25T13:42:07+00:00Added an answer on May 25, 2026 at 1:42 pm

    This will do it:

    itemizedOverlay.addOverlay(overlayitem[0]); 
    

    Explanation: the OverlayItem... is called varargs and is an array of presented type.

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

Sidebar

Related Questions

I have the following method which uses implicit scheduling: private async Task FooAsync() {
I have written this code which accesses the Delete method on Web Service x,
I have an async queue processor that has a Run method which keeps running
I have this sample code for async operations (copied from the interwebs) public class
I have the following code in actionscript 3: var async:AsyncToken; async = bridge.retornamenu(); The
I have the following code in action script 3: async.addResponder(new Responder(result, defaultFaultHandler)); result is
I have an Async method returning a Task. I also wish to offer a
I have an ASP.NET MVC action method which uses model binding to accept a
I have a widget (Main.java) which encapsulates funcionality and implements the Async Provider pattern
I have generic async task class which fetches response from server . And i

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.