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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:19:54+00:00 2026-05-24T09:19:54+00:00

I’ve been developing an app that reads a .csv file, takes out approximately 16

  • 0

I’ve been developing an app that reads a .csv file, takes out approximately 16 latitude/longitude points, and plots them on a Google Map.

However, it seems that the points don’t like to plot until I touch the screen after about a minute (I have no listeners established) [this is a separate problem that maybe someone can answer as well].

The task of getting the latitude/longitude points and plotting them is put into an AsyncTask doInBackground method. Refreshing the map’s drawable state is done in the AsyncTask’s onPostExecute method.

I figured that I would eliminate lag since I have the AsyncTask method working for me. When the program starts, it shows a blank map, I wait about 15 seconds and, if I touch the map, the points will plug in. However, the map is unbearably laggy at this point! It takes the app at least 5 seconds to respond to my interaction (i.e. zoom, scroll), and even then it does the action really slow…

Does anything think they know the cause of this?

Here’s most of my code:

package net.learn2develop.GoogleMaps;

-- imports here


public class MapsActivity extends MapActivity 
{    
MapView mapView; 
MapController mc;
//GeoPoint p;
//GeoPoint p2;
GeoPoint[] p99 = new GeoPoint[16];
public static String[][] bump = null;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mapView = (MapView) findViewById(R.id.mapView);
    LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);  
    @SuppressWarnings("deprecation")
    View zoomView = mapView.getZoomControls(); 

    mapView.setStreetView(true);
    mapView.setSatellite(false);

    zoomLayout.addView(zoomView, 
        new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, 
            LayoutParams.WRAP_CONTENT)); 
    mapView.displayZoomControls(true);

    mc = mapView.getController();


    // Add points from ReadCsv.java

    /** try/catch to-> async was cut from here */
    new MapPoint().execute(bump);


    mapView.invalidate();
}

public String[][] getArray(BufferedReader bufRdr) {
          -- my method that I know works
}


@Override
protected boolean isRouteDisplayed() {
    return false;
}

class MapOverlay extends com.google.android.maps.Overlay {
    @Override
    public boolean draw(Canvas canvas, MapView mapView, 
            boolean shadow, long when) 
    {
        super.draw(canvas, mapView, shadow);                   

        // -- array of points---
        for(int i = 0; i < bump.length; i++) {
            Point screenPts99 = new Point();
            mapView.getProjection().toPixels(p99[i], screenPts99);
            Bitmap bmp99 = BitmapFactory.decodeResource(
                    getResources(), R.drawable.redpin);
            canvas.drawBitmap(bmp99, screenPts99.x, screenPts99.y-44, null);
        }

        return true;
    } 
}

private class MapPoint extends AsyncTask <String[][], String, String> {

    @Override
    protected String doInBackground(String[][]... voidThisArray) {
        String voidThisString = null;
        try {
            InputStream is = getAssets().open("Training4.csv");
            BufferedReader reader = new BufferedReader(new InputStreamReader(is));
            bump = getArray(reader);
            if(bump == null){
                setContentView(R.layout.deleteme);
            } else {
                for(int i = 0; i < bump.length; i++) {
                    String coordinates99[] = {bump[i][0], bump[i][1]};
                    double lat99 = Double.parseDouble(coordinates99[0]);
                    double lng99 = Double.parseDouble(coordinates99[1]);
                    p99[i] = new GeoPoint(
                            (int) (lat99 * 1E6),
                            (int) (lng99 * 1E6));
                    MapOverlay mapOverlay99 = new MapOverlay();
                    List<Overlay> listOfOverlays99 = mapView.getOverlays();
                    listOfOverlays99.add(mapOverlay99);
                    mapView.refreshDrawableState();
                } 
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        return voidThisString;
    }

    @Override
    protected void onPostExecute(String voidThisString) {
        super.onPostExecute(voidThisString);
        mapView.refreshDrawableState();
        mapView.invalidate();
    }

}

}
  • 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-24T09:19:55+00:00Added an answer on May 24, 2026 at 9:19 am

    in onPostExecute use the mapView.invalidate(); method it’ll refresh it and whatever you done in inBackground() that will be refreshing by this method

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.