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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:39:05+00:00 2026-06-06T05:39:05+00:00

I am showing place by using pin image on google map in android by

  • 0

I am showing place by using pin image on google map in android by calling This Url

This url refresh all the time when zoom-in or zoom-out map.
I am using this code for populating pin on map call url in doInbackground an load in onPostExcution of AsyncTask As-

if(!valueoftotal.equalsIgnoreCase("") && !valueoftotal.equalsIgnoreCase(null))
{
    if(Integer.parseInt(valueoftotal) > 0 && Integer.parseInt(valueoftotal) <= 100)
    {
        OverlayItem oi;
        if(myHandler.getParsedData()!=null)
        {
            arrayList = myHandler.getParsedData();      
        }

        linearbottom2.setClickable(true);
        mapOverlays.clear();
        //OverlayItem overlayItem,overlayItem1;
        overlay.removeAll();

        lineartabbar.setBackgroundResource(R.drawable.mapbar);

        if( arrayList.size()!=0 && arrayList.size()>1 )
        {
            for(int i = 0; i < arrayList.size(); i++)
            {
                String latvalue = arrayList.get(i).getLatitude().toString();
                String lonvalue = arrayList.get(i).getLongitude().toString();
                GeoPoint point = null;

                try
                {
                    point = new GeoPoint((int)(Double.parseDouble(latvalue)*1E6),(int)(Double.parseDouble(lonvalue)*1E6));
                }
                catch (NumberFormatException e) 
                {
                    // TODO: handle exception
                }

                if(point != null)
                {

                    if(arrayList.get(i).getUnitstotal().equalsIgnoreCase("1"))
                    {  
                        oi = overlay.createItem(i);
                        System.out.println("overlayyyyyyyyyyyyy" + overlay + "\toiiiiiiiiii"+oi);
                        if(overlay!=null)
                        {
                            overlay.addItem(oi);
                        }
                     }
                     else if(!arrayList.get(i).getUnitstotal().equalsIgnoreCase("1"))
                     {
                         oi = overlay.createItem(i);
                         if(overlay!=null)
                         {
                             System.out.println("2overlayyyyyyyyyyyyy" + overlay + "\toiiiiiiiiii" + oi);
                             overlay.addItem(oi);
                         }
                     }
                 }
             }
             mapOverlays.add(overlay);
             mapView.invalidate();
         }
         else if( arrayList.size()!=0 && arrayList.size()==1 )
         {
             for(int i = 0; i < arrayList.size(); i++)
             {
                 String latvalue = arrayList.get(i).getLatitude().toString();
                 String lonvalue = arrayList.get(i).getLongitude().toString();
                 GeoPoint point = null;
                 try
                 {
                     point = new GeoPoint((int)(Double.parseDouble(latvalue)*1E6),(int)(Double.parseDouble(lonvalue)*1E6));
                 }
                 catch (NumberFormatException e)
                 {
                     // TODO: handle exception
                 }

                 if(point != null)
                 {
                     if(arrayList.get(i).getUnitstotal().equalsIgnoreCase("1"))
                     {
                         oi = overlay.createItem(i);
                         System.out.println("listing when 1 value is  "+arrayList.get(i).getUnitstotal());
                         overlay.addItem(oi);
                         mc.animateTo(point);
                     }
                     else if(!arrayList.get(i).getUnitstotal().equalsIgnoreCase("1"))
                     {
                         oi = overlay.createItem(i);
                         System.out.println("listing when more value is  "+ arrayList.get(i).getUnitstotal());
                         overlay.addItem(oi);
                         mc.animateTo(point);
                         mc.setCenter(point);
                         mc.setZoom(18);
                     }
                 }
             }

             mapOverlays.add(overlay);
             mapView.invalidate();
             MapController mcontrller =mapView.getController();

But the problem is when I touch map immediately, it remove all pin and start loading new position. I want to load smoothly get all the position first and then remove.

Please anyone help me ASAP, sorry for my explanation.

  • 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-06T05:39:08+00:00Added an answer on June 6, 2026 at 5:39 am
    public class HelloAndroidGpsActivity extends Activity implements OnClickListener, android.content.DialogInterface.OnClickListener 
    {
         private EditText editTextShowLocation;
         private Button buttonGetLocation;
         private ProgressBar progress;
    
         private LocationManager locManager;
         private LocationListener locListener = new MyLocationListener();
    
         private boolean gps_enabled = false;
         private boolean network_enabled = false;
    
         /** Called when the activity is first created. */
         @Override
         public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.main);
              editTextShowLocation = (EditText) findViewById(R.id.editTextShowLocation);
              progress = (ProgressBar) findViewById(R.id.progressBar1);
              progress.setVisibility(View.GONE);
              buttonGetLocation = (Button) findViewById(R.id.buttonGetLocation);
              buttonGetLocation.setOnClickListener(this);
              locManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
         }
    
         @Override
         public void onClick(View v) {
              progress.setVisibility(View.VISIBLE);
              // exceptions will be thrown if provider is not permitted.
              try {
                   gps_enabled = locManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
              } catch (Exception ex) {
    
              }
              try {
                   network_enabled = locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
              } catch (Exception ex) {
    
              }
    
              // don't start listeners if no provider is enabled
              if (!gps_enabled && !network_enabled) {
                    AlertDialog.Builder builder = new Builder(this);
                    builder.setTitle("Attention!");
                    builder.setMessage("Sorry, location is not determined. Please enable location providers");
                    builder.setPositiveButton("OK", this);
                    builder.setNeutralButton("Cancel", this);
                    builder.create().show();
                    progress.setVisibility(View.GONE);
              }
    
              if (gps_enabled) {
                    locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener);
              }
              if (network_enabled) {
                    locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locListener);
              }
          }
    
    class MyLocationListener implements LocationListener {
        @Override
        public void onLocationChanged(Location location) {
            if (location != null) {
                // This needs to stop getting the location data and save the battery power.
                locManager.removeUpdates(locListener); 
    
                String londitude = "Londitude: " + location.getLongitude();
                String latitude = "Latitude: " + location.getLatitude();
                String altitiude = "Altitiude: " + location.getAltitude();
                String accuracy = "Accuracy: " + location.getAccuracy();
                String time = "Time: " + location.getTime();
    
                editTextShowLocation.setText(londitude + "\n" + latitude + "\n" + altitiude + "\n" + accuracy + "\n" + time);
                progress.setVisibility(View.GONE);
            } 
        }
    
        @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) {
            // TODO Auto-generated method stub
    
        }
    }
    
    @Override
    public void onClick(DialogInterface dialog, int which) {
        if(which == DialogInterface.BUTTON_NEUTRAL){
            editTextShowLocation.setText("Sorry, location is not determined. To fix this please enable location providers");
        }else if (which == DialogInterface.BUTTON_POSITIVE) {
            startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
        }
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the jquery plugin that im using is this http://code.google.com/p/jquery-in-place-editor/ if i have a table
I have a page where i'm using edit-in-place... now, after the update it's showing
Using PHP, and MySql, I am trying to implement this rather snazzy in-place editor
I am using this to place some repeated code onto my page from an
extjs context menu is showing up occaisionally in the wrong place. Top left of
This is me showing that I didn't get a CS degree. What I'm wondering
Say I'm showing the user a form, and using a BackgroundWorker to do some
I guess many people already read this article: Using your own SQLite database in
I have Android application which is Sales Rep application.When he using the app first
I am developing a small desktop application in JAVA using Netbeans. I place a

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.