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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:54:25+00:00 2026-05-23T20:54:25+00:00

I have a strange problem and really dont know where to start debug. I

  • 0

I have a strange problem and really dont know where to start debug. I have 2 activities one that holds a googlemap view and when the user taps the marker on the view i start a new activity that shows a detailed description of that marker. If i hit the back buttton on my detalied activity it returns me to the map activity, so far so good. BUT if i tap a new (or same) marker i get to the detailed activity again (all fine) if i try to hit the back button again i get returned to the detailed activity that i tapped the very first time, and i can hit back once more and finaly get to the map activity again.

if i keep debugggin i can get up to 10 activities that i have to push back on before i finaly get to the map activity again

what the heck is going on ? does android forget history or something due to i implement the map activity instead of activity ?

anyone that has an idea of where to start looking for the problem

Here comes a lot of code:

map activity

public class SpotGuideMapActivity extends MapActivity
{
    protected MapView mapView;
    protected MapController mapController;
    protected List<Overlay> mapOverlays;
    protected Drawable overlayIcon;
    protected SpotGuideOverlay spotsOverlay;
    protected MyLocationOverlay myLocOverlay;

    protected ArrayList<SpotItem> _spots;

    protected Button ButtonHome;
    protected Button ButtonPreferences;

    protected Intent _intent = null;


    private SpotGuideDbAdapter _spotDbAdapter;


    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.spot_map);
        _intent = getIntent();
        ActivityHelper.createInstance(this).setTopBarTitle("Spot kortet");

        ButtonPreferences = (Button)findViewById(R.id.btnPreferences);
        ButtonPreferences.setOnClickListener(new View.OnClickListener() 
        {
            @Override
            public void onClick(View v) 
            {


                startActivity(new Intent(getApplicationContext(), GlobalPreferencesActivity.class));         
                overridePendingTransition(R.anim.slide_right_in,R.anim.slide_right_out);
            }
        });

        ButtonHome = (Button)findViewById(R.id.btnHome);
        ButtonHome.setOnClickListener(new View.OnClickListener() 
        {
            @Override
            public void onClick(View v) 
            {
                startActivity(new Intent(getApplicationContext(), HomeActivity.class));         
                 overridePendingTransition(R.anim.slide_left_in,R.anim.slide_left_out);
            }
        });


        //mapView.invalidate();
    }

    @Override
    protected void onResume() 
    {
        super.onResume();
        if(_intent.hasExtra("latitude") && _intent.hasExtra("longitude"))
        {
            String latitude = _intent.getStringExtra("latitude");
            String longitude = _intent.getStringExtra("longitude");
            double lat = Double.parseDouble(latitude);
            double lon = Double.parseDouble(longitude);

            GeoPoint point = new GeoPoint((int)(lat * 1E6) , (int)(lon * 1E6));
            initMapView(point);
        }
        else
        {
            initMapView(null);
        }

        drawSpotMarkers();

    }
    @Override
    protected void onPause() 
    {
        super.onPause();
        myLocOverlay.disableCompass();
        myLocOverlay.disableMyLocation();

    }

    protected void initMapView(GeoPoint centerPoint) 
    {

        mapView = (MapView)findViewById(R.id.spotGuideMap);
        mapView.setBuiltInZoomControls(true);
        mapController = mapView.getController();

        //current location overlayer
        myLocOverlay = new MyLocationOverlay(this, mapView);
        myLocOverlay.enableCompass();
        myLocOverlay.enableMyLocation();

        mapView.getOverlays().add(myLocOverlay);

        GeoPoint point = null;
        if(centerPoint == null)
        {
            point = myLocOverlay.getMyLocation();
            if(point == null)   
            {
                point = new GeoPoint((int)(55.5616508394963 * 1E6) , (int)(12.563638687133789 * 1E6));
            }
        }
        else 
        {
            point = centerPoint;
        }
        //get the last know location, be fresh so use last fix
        //Location location = myLocOverlay.getLastFix();
        //GeoPoint locationPoint;

        //locationPoint = new GeoPoint((int)(location.getLatitude() * 1E6) , (int)(location.getLongitude() * 1E6));

        mapController.animateTo(point);
        mapController.setZoom(10);      
    }

    protected void drawSpotMarkers() 
    {
        mapOverlays = mapView.getOverlays();

        overlayIcon = getResources().getDrawable(R.drawable.map_icon_pink);
        spotsOverlay = new SpotGuideOverlay(overlayIcon, this);

        _spotDbAdapter = new SpotGuideDbAdapter(this).Open();
        _spots = _spotDbAdapter.getAllSpots();

        for (SpotItem spot : _spots) 
        {
            double lat = Double.parseDouble(spot.getLatitude());
            double lon = Double.parseDouble(spot.getLongitude());

            GeoPoint point = new GeoPoint((int)(lat * 1E6) , (int)(lon * 1E6));

            OverlayItem overlayitem = new OverlayItem(point, spot.getSpotTitle(), Integer.toString(spot.getId()));

            spotsOverlay.addOverlay(overlayitem);
        }


        mapOverlays.add(spotsOverlay);


    }


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

}

detailed activity

public class SpotGuideDescriptionActivity extends BaseActivity
{
    private SpotGuideDbAdapter _spotDbAdapter;

    protected Button ButtonHome;
    protected Button ButtonPreferences;

    protected Button ButtonBacktoMap;

    protected TextView tvSpotTitle;
    protected TextView tvSpotType;
    protected TextView tvWindDirection;
    protected TextView tvContent;

    protected Intent _intent = null;
    protected SpotItem item;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.spot_description);
        _intent = getIntent();

        this.getActivityHelper().setTopBarTitle("Spot beskrivelse");

        tvSpotTitle = (TextView)findViewById(R.id.spotDescTitle);
        tvSpotType = (TextView)findViewById(R.id.spotDescType);
        tvWindDirection = (TextView)findViewById(R.id.spotDescWind);
        tvContent = (TextView)findViewById(R.id.spotDescContent);

        ButtonBacktoMap = (Button)findViewById(R.id.btnBackToMap);
        ButtonBacktoMap.setOnClickListener(new View.OnClickListener() 
        {
            @Override
            public void onClick(View v) 
            {
                Intent intent = new Intent(getApplicationContext(), SpotGuideMapActivity.class);
                intent.putExtra("latitude", item.getLatitude());
                intent.putExtra("longitude", item.getLongitude());
                startActivity(intent);                    
                overridePendingTransition(R.anim.slide_left_in,R.anim.slide_left_out);
            }
        });

        ButtonPreferences = (Button)findViewById(R.id.btnPreferences);
        ButtonPreferences.setOnClickListener(new View.OnClickListener() 
        {
            @Override
            public void onClick(View v) 
            {


                startActivity(new Intent(getApplicationContext(), GlobalPreferencesActivity.class));         
                overridePendingTransition(R.anim.slide_right_in,R.anim.slide_right_out);
            }
        });

        ButtonHome = (Button)findViewById(R.id.btnHome);
        ButtonHome.setOnClickListener(new View.OnClickListener() 
        {
            @Override
            public void onClick(View v) 
            {
                startActivity(new Intent(getApplicationContext(), HomeActivity.class));         
                 overridePendingTransition(R.anim.slide_left_in,R.anim.slide_left_out);
            }
        });

        init();
    }

    private void init()
    {
        if(_intent.hasExtra("spot_id"))
        {
            int id = _intent.getIntExtra("spot_id", 0);
            _spotDbAdapter = new SpotGuideDbAdapter(this).Open();

            item = _spotDbAdapter.getSpot(id);
            tvSpotTitle.setText(item.getSpotTitle());
            tvSpotType.setText(item.getSpotType());
            tvWindDirection.setText(item.getWindDirections());
            tvContent.setText(item.getSpotDescription());
        }
    }
}

And i init the tap in my OverlayItem like this

public boolean onTap(int index)
    {
        OverlayItem item = mOverlays.get(index);

        Intent descIntent = new Intent(currentContext.getApplicationContext(), SpotGuideDescriptionActivity.class);
        descIntent.putExtra("spot_id", item.getSnippet());
        currentContext.startActivity(descIntent);

        return false;

    }

it is not the BackToMap button that i use, it is the back button on all phones

  • 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-23T20:54:25+00:00Added an answer on May 23, 2026 at 8:54 pm

    I haven’t worked with maps, so I may be off my rocker. But the fact that you are calling initMapView() in OnResume() might be creating two markers one on top of the other (and again, every time you go back). So when you think you are taping on one marker, you are actually taping on multiple markers.

    That’s just off the top of my head, and can be total malarkey.

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

Sidebar

Related Questions

We have very strange problem, one of our applications is continually querying server by
I have a strange problem with mod_rewrite, the rules that are relevant here are:
I have a strange problem that is only happening in a single location. I
I have a strange problem that I could not solve. When I try to
I have this really strange problem where my entity framework query isn't enumerating correctly.
I have a really strange problem, following attribute of a jsp tag <custom:tag onclick=addBid('<%=
I have a strange problem in my android application. I am starting one activity
I've got a strange problem here. Assume that I have a class with some
I have a really strange issue with my application and I don't know why
I have a strange problem that I think has to do with routes. In

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.