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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:45:48+00:00 2026-05-25T17:45:48+00:00

I am setting the Map to Satellite view on click of a toggle button

  • 0

I am setting the Map to Satellite view on click of a toggle button

 mapToggle.setOnClickListener(new OnClickListener()
     {

         public void onClick(View v)
         {
             if (mapToggle.isChecked())
             {   
                 mapV.setSatellite(true);  

             } else {   
                 mapV.setSatellite(false);  
             }   
    }});

I want to programitically determine which mode it is in when the app restarts. Please advice.

  • 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-25T17:45:48+00:00Added an answer on May 25, 2026 at 5:45 pm

    The way I accomplished this is to set an int value in your SharedPreferences. Then onClick of that button, get the value and switch satellite on or off accordingly.

    private static final int OVERLAY_STREET = 0;
    private static final int OVERLAY_SAT = 1;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
    
        int currentOverlayMode = prefs.getInt("map_viewmode", 0);
    
        mOverlayModeBtn = (Button)findViewById(R.id.googlemaps_overlay_btn);
        mOverlayModeBtn.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (currentOverlayMode < 1)
                    currentOverlayMode++;
                else
                    currentOverlayMode = 0;
                switch (currentOverlayMode) {
                case OVERLAY_STREET:
                    mMaps.setSatellite(false);
                    mMaps.setStreetView(true);
                    prefsEditor.putInt("map_viewmode", OVERLAY_STREET);
                    break;
                case OVERLAY_SAT:
                    mMaps.setStreetView(false);
                    mMaps.setSatellite(true);
                    prefsEditor.putInt("map_viewmode", OVERLAY_SAT);
                    break;
                }
                prefsEditor.commit();
                mMaps.invalidate();
            }
        });
    }
    

    You may want to clean it up a little, but it works for me.

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

Sidebar

Related Questions

I have something like this in my Map public class Settings : ClassMap<Setting> {
I am zooming out the map on the click of the button. So when
I am setting the data in model as: @RequestMapping(/forms/builder/) public void renderMethod1(Model model) {
I'm setting up a new solution to map against SQL data that has been
Setting up new git installations. On one Windows laptop, I'm running (under cygwin): git
When setting up a new virtual directory for hosting a SOAP web service in
Does anyone know why setting the map as hybrid has no effect. Setting it
I am setting up a map on a drupal website using the mapstraction module.
I am setting up a contact page with a google map. I created a
I have a UISegmentedControl containing 3 options for selecting map type. I am setting

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.