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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:06:44+00:00 2026-06-12T02:06:44+00:00

i’m trying to make a map in my application which the latitude and longitude

  • 0

i’m trying to make a map in my application which the latitude and longitude from my database MySQL.

that’s my screenshot listview when click i want to show on map.

and here’s my activity :

public class Map_TokoBengkel extends MapActivity {
    private MapView mapView;
    private LocationManager locManager;
    private LocationListener locListener;
    Entity_BikeShopRepair entity;
    private ArrayList<Entity_BikeShopRepair> list_lokasi = new ArrayList<Entity_BikeShopRepair>();

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map_shoprepair);

        final ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar);
        actionBar.setTitle(getString(R.string.app_name));

        actionBar.setHomeAction(new IntentAction(this, new Intent(this,
                Home_Activity.class), R.drawable.home));

        initLokasi();
        initMap();
        initLocationManager();
    }

    /**
     * Initialize the map to the Data Location.
     */
    private void initLokasi() {
        list_lokasi.add(entity.getLat(), entity.getLng(), 1, entity.getShop_Name());
    }

    /**
     * Initialize the map to the LinearLayout.
     */
    private void initMap() {
        mapView = (MapView) findViewById(R.id.map_view);
        mapView.displayZoomControls(true);
        mapView.setBuiltInZoomControls(true);
        mapView.getController().setZoom(15);
    }

    /**
     * Initialize the location manager.
     */
    private void initLocationManager() {
        locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

        locListener = new LocationListener() {
            // method ini akan dijalankan apabila koordinat GPS berubah
            public void onLocationChanged(Location newLocation) {
                tampilkanPosisikeMap(newLocation);
            }

            public void onProviderDisabled(String arg0) {
            }

            public void onProviderEnabled(String arg0) {
            }

            public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
            }
        };
        locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
                1000, locListener);

    }

    /**
     * This method will be called when current position changed is submitted via
     * the GPS.
     * 
     * @param newLocation
     */
    protected void tampilkanPosisikeMap(Location newLocation) {
        List<Overlay> overlays = mapView.getOverlays();

        // first remove old overlay
        if (overlays.size() > 0) {
            for (Iterator iterator = overlays.iterator(); iterator.hasNext();) {
                iterator.next();
                iterator.remove();
            }
        }

        // transform the location to a geopoint
        GeoPoint geopoint = new GeoPoint(
                (int) (newLocation.getLatitude() * 1E6),
                (int) (newLocation.getLongitude() * 1E6));
        GeoPoint myposition = geopoint;
        Location locationA = new Location("point A");
        Location locationB = new Location("point B");
        locationA.setLatitude(geopoint.getLatitudeE6() / 1E6);
        locationA.setLongitude(geopoint.getLongitudeE6() / 1E6);
        // initialize icon
        Drawable icon = getResources().getDrawable(R.drawable.marker);
        icon.setBounds(0, 0, icon.getIntrinsicWidth(),
                icon.getIntrinsicHeight());

        // create my overlay and show it
        MyItemizedOverlay overlay = new MyItemizedOverlay(icon, this);
        OverlayItem item = new OverlayItem(geopoint, "My Location", "Lat:"
                + locationA.getLatitude() + "\nLng:" + locationA.getLongitude());
        overlay.addItem(item);
        mapView.getOverlays().add(overlay);
        for (int i = 0; i < list_lokasi.size(); i++) {
            geopoint = new GeoPoint((int) (list_lokasi.get(i).lat * 1E6),
                    (int) (list_lokasi.get(i).lng * 1E6));
            locationB.setLatitude(geopoint.getLatitudeE6() / 1E6);
            locationB.setLongitude(geopoint.getLongitudeE6() / 1E6);

            double distance = locationA.distanceTo(locationB);

            if (list_lokasi.get(i).category == 1) {
                icon = getResources().getDrawable(R.drawable.bicycle_shop);
            } else if (list_lokasi.get(i).category == 2) {
                icon = getResources().getDrawable(R.drawable.bicycle_shop);
            } else if (list_lokasi.get(i).category == 3) {
                icon = getResources().getDrawable(R.drawable.bicycle_shop);
            }

            icon.setBounds(0, 0, icon.getIntrinsicWidth(),
                    icon.getIntrinsicHeight());
            overlay = new MyItemizedOverlay(icon, this);
            item = new OverlayItem(geopoint, list_lokasi.get(i).lokname, "Lat:"
                    + list_lokasi.get(i).lat + "\nLng:"
                    + list_lokasi.get(i).lng + "\n Jarak:" + distance + "m");
            overlay.addItem(item);
            mapView.getOverlays().add(overlay);
        }

        // move to location
        mapView.getController().animateTo(myposition);

        // redraw map
        mapView.postInvalidate();
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
}

but at that code there is something error in

private void initLokasi() {
    list_lokasi.add(entity.getLat(), entity.getLng(), 1, entity.getShop_Name());
} 

and the error message is:

The method add(int, Entity_BikeShopRepair) in the type ArrayList<Entity_BikeShopRepair> is not applicable for the arguments (double, double, int, String)`.

can somebody help me solved my problem?

  • 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-12T02:06:45+00:00Added an answer on June 12, 2026 at 2:06 am

    The problem is right there in the error

    The method add(int, Entity_BikeShopRepair) in the type
    ArrayList is not applicable for the arguments
    (double, double, int, String)

    The compiler is telling you that it is expecting you to give it an int and an Entity_BikeShopRepair and instead you’re giving it four parameters so it doesn’t know what to do.

    list_lokasi.add(entity.getLat(), entity.getLng(), 1, entity.getShop_Name()); 
    

    It looks like you just need to do

    list_lokasi.add(1, entity);
    

    or, if you don’t care what position in the list the entity is added,

    list_lokasi.add(entity);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I have a view passing on information from a database: def serve_article(request, id): served_article
Basically, what I'm trying to create is a page of div tags, each has
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

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.