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 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 an async queue processor that has a Run method which keeps running
I have written this code which accesses the Delete method on Web Service x,
I have an ASP.NET MVC action method which uses model binding to accept a
I have a webmethod which is trying to construct xml data document and return
I have a parent form which saves the settings and changes user puts. But
I have a code in which i bind a dropdownlist to a database and
I'm trying to test a service method that runs asynchronously (@Async). Here is the
I have a webservice method which takes an Id and then will kick off
I know how to make Async methods but say I have a method that
Have just started using Google Chrome , and noticed in parts of our site,

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.