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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:16:06+00:00 2026-06-16T20:16:06+00:00

I need to draw a path on the map. To do so, i thought

  • 0

I need to draw a path on the map. To do so, i thought about using Polyline since the new google maps. My problem is that my application works, but it doesnt draw a thing on the map. I want it to draw everytime i change position, basically to draw my path.

public class MapActivity extends FragmentActivity implements LocationListener {
    GoogleMap               myMap;
    Location                lastLocation;
    private LocationManager locManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map_layout);
        myMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
        myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);


        locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        boolean networkEnabled = locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
        if (!networkEnabled) {
            Toast.makeText(this, "network not enabled", 0);
        }

    }

    @Override
    protected void onResume() {
        super.onResume();
        locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);

    }


    @Override
    public void onLocationChanged(Location location) {
        if (location != null) {
            lastLocation=locManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
            Polyline line=myMap.addPolyline(new PolylineOptions().add(new LatLng(location.getLatitude(),location.getLongitude())).color(Color.RED));

        }
    }

    @Override
    public void onProviderDisabled(String provider) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onProviderEnabled(String provider) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {
  • 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-16T20:16:07+00:00Added an answer on June 16, 2026 at 8:16 pm

    Lines require a minimum of two points. You are attempting to draw a line using only a single point. This will draw an infinitely small line, which you will have difficulty seeing, since it is infinitely small.

    If you want to draw a line, use two or more points. If you want to draw something at a single point, use a marker, not a polyline.

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

Sidebar

Related Questions

Background I´m developing an application that displays a path over a map (Google maps
I need to draw text onto a window HDC along a circular path using
For my project i need to draw a path between two points on google
I am building an application in iphone for that I need to draw a
This is my code: function trainRoute(startPoint, endPoint) { var polyline = new google.maps.Polyline({ strokeColor:
I need to draw simple alpha maps in xna which depends on current game
I need to draw a lot of lines. I'm using UIBezierPath for drawing lines
A need to draw an X in a View using Shapes , but the
I need to draw an arc using GraphicsPath and having initial, median and final
I need a line that changes color along the path (which could be approximated

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.