Giter VIP home page Giter VIP logo

android-samples's People

Contributors

alishari avatar amuramoto avatar arriolac avatar barbeau avatar bellarm avatar cf256 avatar dependabot-preview[bot] avatar dependabot[bot] avatar domesticmouse avatar googlemaps-bot avatar jfschmakeit avatar jonesfloyd avatar jpoehnelt avatar katherineallen avatar kikoso avatar louiscad avatar malukimuthusi avatar markmcd avatar masterbin avatar melashkov avatar msambol avatar sarahmaddox avatar stephenmcd avatar wangela avatar willum070 avatar witek86 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-samples's Issues

markers cannot show Hebrew text

Maybe also Arabic.
Here's what I get for putting a title in Hebrew of the word "Israel" ("ישראל") :

device-2015-12-03-111306

Here's the code:

                        mMap.addMarker(new MarkerOptions()
                                .position(latLng)
                                .title(locationTitle)
                                .snippet("snippet")
                                .icon(BitmapDescriptorFactory.fromResource(R.drawable.arrow))
                                .infoWindowAnchor(0.5f, 0.5f));

BTW, the map is wrong for Israel's borders. It has the north-east area ("Ramat Hagolan") for a very long time. It doesn't make sense to show the old borders of before the wars.

Israel also includes the west bank and the east area ("Yehuda" and "Shomron"), which is also why it's ok to travel to the entire Jordan river.
It's just that those areas are problematic (except for Ramat Hagolan, which isn't problematic at all)

My Location Demo isn't able to zoom to one's location

Although the marker is present at the correct location, the map remains zoomed out and center at geographic midpoints for latitude and longitude... in the middle of the Atlantic Ocean. Manually scrolling and zooming does reveal the correctly placed marker.

The Android Monitor window is full of lines similar to the following:
09-05 13:12:34.456 14247-15011/com.example.mapdemo W/Google Maps Android API: GLHudOverlay deprecated; draw(): no-op

Google Maps Offline

Good afternoon.

Is there any way to use offline maps, as it does in the application of google maps in my apolicacion developed with Android Studio?

How to update Google Play services on Emulator?

I got the Key and set restrict, but I still cannot open map on the Emulator. On the build.gradle, I saw that the google play service is 9.8.0 now, and I think this is the newest one. However, when I run the sample-app, it say I need to update Google Play service?

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.google.android.gms:play-services-maps:9.8.0' }

I check on the Android Emulator that it doesn't have Play store. Is it the missing one? I follow this link
https://developers.google.com/maps/documentation/android-api/start#step_2_install_the_google_play_services_sdk

to install Google Play services but I cannot found anything that can help. My Android studio version is 2.2.2.
I download the GooglePlayServices apk file (com.google.android.gms-9.8.77-440-135396225-APK4Fun.com), I dragged and dropped it into emulator to install, but it has error
Error: INSTALL FAIL INCOMPATIABLE

I need your help.

How does the camera automatically rotate 360 degrees?

I try ..., but it delayed about 1s between processing Handlers.

final int degrees = 90;
            for (int i = 0; i < 4; i++) {
                final int index = i + 1;
                (new Handler()).postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        StreetViewPanoramaCamera camera = new StreetViewPanoramaCamera.Builder().zoom(
                                panorama.getPanoramaCamera().zoom)
                                .tilt(panorama.getPanoramaCamera().tilt)
                                .bearing(panorama.getPanoramaCamera().bearing + degrees)
                                .build();
                        panorama.animateTo(camera, 10000 * index);
                    }
                }, i * (10000 - 1000));
            }

Retrieve map state while switching between fragments

hi guys,

i need a hand about this issue, im using NavigationDrawer in my code and every time user choose an item from:
onNavigationItemSelected(MenuItem item) a fragment will be loaded, 1 have a fragment which i implemented a map inside with some markers and clusters the problem is when the user go to another fragment and he comeback again to the fragment with map all these markers and clusters going to be generated again and it makes the app really slow what you suggest for it?

MainActivity:

    public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {

    NavigationView navigationView = null;
    Toolbar toolbar = null;
    GoogleMap nMap;
    SparseArray<Fragment> myFragments;
    JSONArray jArray;
    private static final int ERROR_DIALOG_REQUEST = 9001;
    public static final int ID_OF_BEACH = 5;
    //initBeach test = new initBeach();
    //JSONArray jsonArray = test.ExcuteLoad();

    /**
     * ATTENTION: This was auto-generated to implement the App Indexing API.
     * See https://g.co/AppIndexing/AndroidStudio for more information.
     */
    private GoogleApiClient client;
    Fragment fragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        myFragments = new SparseArray<>();

        //setTitle("");
        setContentView(R.layout.activity_main);

        if (servicesOK()) {
            try {
                jArray = new LoadJson().execute().get();
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            setContentView(R.layout.activity_main);
        }

        //Set the fragment initially
        FragmentTransaction fragmentTransaction =
                getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.fragment_container, new MainFragment(jArray));
        fragmentTransaction.addToBackStack("1");
        fragmentTransaction.commit();

        toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        //noinspection ConstantConditions
        getSupportActionBar().setDisplayShowTitleEnabled(false);


        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.setDrawerListener(toggle);
        toggle.syncState();


        navigationView = (NavigationView) findViewById(R.id.nav_view);

        //How to change elements in the header programatically


        navigationView.setNavigationItemSelectedListener(this);
        // ATTENTION: This was auto-generated to implement the App Indexing API.
        // See https://g.co/AppIndexing/AndroidStudio for more information.
        client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
        navigationView.setItemIconTintList(null);

    }

    @Override
    public void onBackPressed() {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        //noinspection SimplifiableIfStatement
        return super.onOptionsItemSelected(item);
    }


    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        // Handle navigation view item clicks here.
        int id = item.getItemId();

        if (id == R.id.nav_camara) {
            fragment = myFragments.get(1);
            // if fragment doesn't exist in myFragments, create one and add to it
            if (fragment == null) {
                fragment = new MainFragment(jArray);
                myFragments.put(1, fragment);
            }
            FragmentTransaction fragmentTransaction =
                    getSupportFragmentManager().beginTransaction();
            fragmentTransaction.replace(R.id.fragment_container, fragment);
            fragmentTransaction.commit();


            // Handle the camera actionn

        } else if (id == R.id.nav_gallery) {
            //Set the fragment initially
            fragment = myFragments.get(2);
            // if fragment doesn't exist in myFragments, create one and add to it
            if (fragment == null) {
                fragment = new GalleryFragment();
                myFragments.put(2, fragment);
            }

            FragmentTransaction fragmentTransaction =
                    getSupportFragmentManager().beginTransaction();
            fragmentTransaction.replace(R.id.fragment_container, fragment);
            fragmentTransaction.commit();


        } else if (id == R.id.nav_search) {
            //Set the fragment initially

            // Handle the camera action

        } else if (id == R.id.nav_manage) {

            // Handle the camera action

        } else if (id == R.id.nav_share) {

        } else if (id == R.id.nav_send) {

        }

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }

    public boolean servicesOK() {

        int isAvailable = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

        if (isAvailable == ConnectionResult.SUCCESS) {
            return true;
        } else if (GooglePlayServicesUtil.isUserRecoverableError(isAvailable)) {
            Dialog dialog =
                    GooglePlayServicesUtil.getErrorDialog(isAvailable, this, ERROR_DIALOG_REQUEST);
            dialog.show();
        } else {
            Toast.makeText(this, "Can't connect to mapping service", Toast.LENGTH_SHORT).show();
        }

        return false;
    }


    @Override
    public void onStart() {
        super.onStart();

        // ATTENTION: This was auto-generated to implement the App Indexing API.
        // See https://g.co/AppIndexing/AndroidStudio for more information.
        client.connect();
        Action viewAction = Action.newAction(
                Action.TYPE_VIEW, // TODO: choose an action type.
                "Main Page", // TODO: Define a title for the content shown.
                // TODO: If you have web page content that matches this app activity's content,
                // make sure this auto-generated web page URL is correct.
                // Otherwise, set the URL to null.
                Uri.parse("http://host/path"),
                // TODO: Make sure this auto-generated app URL is correct.
                Uri.parse("android-app://com.compscitutorials.basigarcia.navigationdrawervideotutorial/http/host/path")
        );
        AppIndex.AppIndexApi.start(client, viewAction);
    }

    @Override
    public void onStop() {
        super.onStop();

        // ATTENTION: This was auto-generated to implement the App Indexing API.
        // See https://g.co/AppIndexing/AndroidStudio for more information.
        Action viewAction = Action.newAction(
                Action.TYPE_VIEW, // TODO: choose an action type.
                "Main Page", // TODO: Define a title for the content shown.
                // TODO: If you have web page content that matches this app activity's content,
                // make sure this auto-generated web page URL is correct.
                // Otherwise, set the URL to null.
                Uri.parse("http://host/path"),
                // TODO: Make sure this auto-generated app URL is correct.
                Uri.parse("android-app://com.compscitutorials.basigarcia.navigationdrawervideotutorial/http/host/path")
        );
        AppIndex.AppIndexApi.end(client, viewAction);
        client.disconnect();
    }


    //AsyincTask to load JSON
    public class LoadJson extends AsyncTask<String, Void, JSONArray> {
        String URLu = "http://www.meteoapps.com/appvalenciaplayas/playaslocales";


        @Override
        protected JSONArray doInBackground(String... params) {

            try {
                URL url = new URL(URLu);
                HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                connection.connect();
                InputStream stream = connection.getInputStream();
                BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
                StringBuffer buffer = new StringBuffer();
                String line = "";
                while ((line = reader.readLine()) != null) {
                    buffer.append(line);
                }
                String finalJson = buffer.toString();

                JSONObject jsonObject = new JSONObject(finalJson);
                JSONArray jsonArray = jsonObject.getJSONArray("marcadores");

                return jsonArray;
            } catch (Exception e) {
                e.printStackTrace();
                return null;
            }

        }

        @Override
        protected void onPostExecute(JSONArray result) {
            super.onPostExecute(result);
        }

        @Override
        protected void onPreExecute() {
          super.onPreExecute();
        }

       }
    }

MainFragment:

public class MainFragment extends Fragment {
GoogleMap nMap;
MapView mapView;
CameraUpdate update;
JSONArray array;
private ClusterManager<ItemCluster> mClusterManager;
private void parseJSON(JSONArray array) {
    if (mapView != null) {
        nMap = mapView.getMap();
        nMap.getUiSettings().setMyLocationButtonEnabled(false);
        nMap.setMyLocationEnabled(true);
        nMap.getUiSettings().setZoomControlsEnabled(true);
        mClusterManager = new ClusterManager<>(this.getActivity(), nMap);
        nMap.setOnCameraChangeListener(mClusterManager);
        nMap.setInfoWindowAdapter(mClusterManager.getMarkerManager());
        nMap.setOnMarkerClickListener(mClusterManager);
    }

    try {
        //Loading LAT LOng of markers on map
        for (int i = 0; i < array.length(); i++) {
            JSONObject jsonObject = array.getJSONObject(i);
            String locality = jsonObject.getString("nombre");
            String vientos = jsonObject.getString("viento");
            int temp = jsonObject.getInt("temperatura");
            double lat = jsonObject.getDouble("lat");
            double lon = jsonObject.getDouble("lon");
            nMap = mapView.getMap();

            mClusterManager.setRenderer(new OwnIconRendered(getActivity().getApplicationContext(), nMap, mClusterManager));
            ItemCluster offsetItem = new ItemCluster(lat, lon, locality, vientos, temp);
            mClusterManager.addItem(offsetItem);
        }
        LatLng latLon = new LatLng(39.4666667, -0.3666667);
        update = CameraUpdateFactory.newLatLngZoom(latLon, 10);
        nMap.moveCamera(update);

    } catch (Exception e) {
        e.printStackTrace();
    }

}

@SuppressLint("ValidFragment")
public MainFragment(JSONArray input) {
    array = input;
}
public MainFragment() {

}



@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_main, container, false);
    mapView = (MapView) rootView.findViewById(R.id.map);
    mapView.onCreate(savedInstanceState);

    parseJSON(array);

    // Inflate the layout for this fragment
    setRetainInstance(true);
    return rootView;

}

class OwnIconRendered extends DefaultClusterRenderer<ItemCluster> {

    private final IconGenerator mClusterIconGenerator = new IconGenerator(getActivity().getApplicationContext());
    private final TextView mClusterImageView;
    private final ImageView mClusterViento;
    private int tempAvg = 0;
    private final Drawable TRANSPARENT_DRAWABLE = new ColorDrawable(Color.TRANSPARENT);


    public OwnIconRendered(Context context, GoogleMap map,
                           ClusterManager<ItemCluster> clusterManager) {
        super(context, map, clusterManager);

        View clusterIcon = getActivity().getLayoutInflater().inflate(R.layout.info_windows, null);
        mClusterIconGenerator.setContentView(clusterIcon);
        mClusterImageView = (TextView) clusterIcon.findViewById(R.id.maxTmp);
        mClusterViento = (ImageView) clusterIcon.findViewById(R.id.viento);

    }

    @Override
    protected void onBeforeClusterItemRendered(ItemCluster item, MarkerOptions markerOptions) {
        markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.marcador_playa));
        markerOptions.title(item.getTitle());
        super.onBeforeClusterItemRendered(item, markerOptions);
    }

    @Override
    protected void onBeforeClusterRendered(Cluster<ItemCluster> cluster, MarkerOptions markerOptions) {

        tempAvg = 0;
        String vientoStr = null;
        for (ItemCluster item : cluster.getItems()) {
            tempAvg = (item.getTemp()+tempAvg);
        }

        mClusterImageView.setText(String.valueOf(tempAvg/cluster.getSize()));
        if ((tempAvg/cluster.getSize()) > 32) {
            mClusterImageView.setBackgroundResource(R.drawable.temp_32_o_mas);
        } else if ((tempAvg/cluster.getSize()) <= 31 && (tempAvg/cluster.getSize()) >= 25) {
            mClusterImageView.setBackgroundResource(R.drawable.temp_25_a_31);
        } else if ((tempAvg/cluster.getSize()) <= 24 && (tempAvg/cluster.getSize()) >= 20) {
            mClusterImageView.setBackgroundResource(R.drawable.temp_20_a_24);
        } else if ((tempAvg/cluster.getSize()) <= 19 && (tempAvg/cluster.getSize()) >= 15) {
            mClusterImageView.setBackgroundResource(R.drawable.temp_15_a_19);
        } else if ((tempAvg/cluster.getSize()) <= 14 && (tempAvg/cluster.getSize()) >= 10) {
            mClusterImageView.setBackgroundResource(R.drawable.temp_10_a_14);
        } else if ((tempAvg/cluster.getSize()) <= 9 && (tempAvg/cluster.getSize()) >= 5) {
            mClusterImageView.setBackgroundResource(R.drawable.temp_5_a_9);
        } else if ((tempAvg/cluster.getSize()) <= 4) {
            mClusterImageView.setBackgroundResource(R.drawable.temp_4_o_menos);
        }

        for (ItemCluster item : cluster.getItems()) {
            vientoStr = item.getViento();
            if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_NE2.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_ne2);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_NW2.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_nw2);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_E2.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_e2);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_NE1.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_ne1);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_NE3.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_ne3);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_NE4.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_ne4);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_NW1.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_nw1);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_NW3.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_nw3);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_NW4.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_nw4);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_E1.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_e1);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_E3.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_e3);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_E4.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_e4);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_N1.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_n1);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_N2.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_n2);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_N3.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_n3);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_N4.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_n4);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_W1.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_w1);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_W2.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_w2);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_W3.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_w3);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_W4.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_w4);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_SW1.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_sw1);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_SW2.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_sw2);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_SW3.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_sw3);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_SW4.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_sw4);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_SE1.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_se1);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_SE2.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_se2);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_SE3.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_se3);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_SE4.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_se4);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_S1.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_s1);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_S2.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_s2);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_S3.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_s3);
            } else if (Objects.equals(vientoStr, "appvalenciaplayas/static/images/viento/viento_S4.svg")) {
                mClusterViento.setImageResource(R.drawable.viento_s4);
            }
            break;
        }


        mClusterIconGenerator.setBackground(TRANSPARENT_DRAWABLE);
        Bitmap bitmap = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize()));
        markerOptions.icon(BitmapDescriptorFactory.fromBitmap(bitmap));
    }


    @Override
    protected boolean shouldRenderAsCluster(Cluster cluster) {
        // Always render clusters.
        return cluster.getSize() > 1;
    }
}


@Override
public void onResume() {
    super.onResume();
    mapView.onResume();
}

@Override
public void onDestroy() {
    super.onDestroy();
    mapView.onDestroy();
}

@Override
public void onPause() {
    super.onPause();
    mapView.onPause();
}

@Override
public void onLowMemory() {
    super.onLowMemory();
    mapView.onLowMemory();
}

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    mapView.onSaveInstanceState(outState);
     }
 }

Bug: redraw when returning to the app

steps:
run the sample app.
open the first item.
click on the marker.
choose to navigate to it.
return to the app by pressing the back button.

The bug:
the map view itself gets refreshed (redrawn).

"Get Place" crashing and Markers

I was using the sample here, about Maps and how to get the Current Location, also following the tutorial available by this link(https://developers.google.com/maps/documentation/android-api/current-place-tutorial#get-the-location-of-the-android-device-and-position-the-map)

When I was testing it, I had and issue when I clicked on "GET PLACE", and then the app Crashed, this is the error list:
08-11 14:40:55.667 20886-20886/com.example.currentplacedetailsonmap E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.currentplacedetailsonmap, PID: 20886
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:401)
at android.widget.ArrayAdapter.getView(ArrayAdapter.java:369)
at android.widget.AbsListView.obtainView(AbsListView.java:2346)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1280)
at android.widget.ListView.onMeasure(ListView.java:1188)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:18804)
at android.support.v7.widget.AlertDialogLayout.tryOnMeasure(AlertDialogLayout.java:135)
at android.support.v7.widget.AlertDialogLayout.onMeasure(AlertDialogLayout.java:63)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
at android.view.View.measure(View.java:18804)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5954)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643)
at android.view.View.measure(View.java:18804)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2112)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1203)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1464)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1119)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6060)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

And the Marker for my Current Location isn't showing, just a blue marker (not the red one).

How can I solve this? Can you guys help me?

Error using newLatLngBounds(LatLngBounds, int)

I copy all the project to my android studio and when i launch the App the the Debug launch this error:

Error using newLatLngBounds(LatLngBounds, int): Map size can't be 0. Most likely, layout has not yet occured for the map view. Either wait until layout has occurred or use newLatLngBounds(LatLngBounds, int, int, int) which allows you to specify the map's dimensions.

What is the problem :(

No config chosen

I created an android application with map activity and I did all configurations.
map used to work but now it doesn't. I get this error

java.lang.IllegalArgumentException: No config chosen at com.google.maps.api.android.lib6.gmm6.vector.ak.a(:com.google.android.gms.DynamiteModulesB:25) at com.google.maps.api.android.lib6.gmm6.vector.ba.f(:com.google.android.gms.DynamiteModulesB:147) at com.google.maps.api.android.lib6.gmm6.vector.ba.run(:com.google.android.gms.DynamiteModulesB:11)

Marker is not Showing on the Map

getting warning in the logs : Google Maps Android API: GLHudOverlay deprecated; draw(): no-op

Please update it i am using com.google.android.gms:play-services-maps:9.4.0

Nothing in MapInPagerDemoActivity

When start the MapInPagerDemoActivity, nothing there because the hint String " <--swipe-->" textColor is white in text_fragment.xml. Need to change it to android:textColor="@android:color/black"

How to set the Man-made buildings's top color with custom map style?

@broady , Hello guys , I got a problem with google map with custom style that set the Man-made buildings's top color. I make a custom json to change my own style in Google map style, and this is the effect of my custom style of bulidings color:
image
that buildings's top color is show correct in the website. but when i put the json into the my project, and the effect in my phone is like this:
image
the color of the Man-made building's color is not correct with what I set in json.

Is this relation with 3D or 2D view? Because I find the website map is a 2D view, and in Android the map is 3D view. If yes, is there a way to turn the map to 2D view?

And my google map service is com.google.android.gms:play-services-maps:9.8.0
and I try to update map service to 10.2.4, it's not work too!

Finally there is my JSON code:

[
  {
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#212121"
      }
    ]
  },
  {
    "elementType": "labels.icon",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "elementType": "labels.text.fill",
    "stylers": [
      {
        "color": "#ffffff"
      }
    ]
  },
  {
    "elementType": "labels.text.stroke",
    "stylers": [
      {
        "color": "#000000"
      }
    ]
  },
  {
    "featureType": "landscape.man_made",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#444444"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "road",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#2c2c2c"
      }
    ]
  },
  {
    "featureType": "road",
    "elementType": "labels.text.fill",
    "stylers": [
      {
        "color": "#8a8a8a"
      }
    ]
  },
  {
    "featureType": "road.arterial",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#373737"
      }
    ]
  },
  {
    "featureType": "road.arterial",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#999999"
      }
    ]
  },
  {
    "featureType": "road.arterial",
    "elementType": "geometry.stroke",
    "stylers": [
      {
        "color": "#999999"
      }
    ]
  },
  {
    "featureType": "road.arterial",
    "elementType": "labels.text.fill",
    "stylers": [
      {
        "color": "#ffffff"
      }
    ]
  },
  {
    "featureType": "road.arterial",
    "elementType": "labels.text.stroke",
    "stylers": [
      {
        "color": "#000000"
      }
    ]
  },
  {
    "featureType": "road.highway",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#3c3c3c"
      }
    ]
  },
  {
    "featureType": "road.highway",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#666666"
      }
    ]
  },
  {
    "featureType": "road.highway",
    "elementType": "geometry.stroke",
    "stylers": [
      {
        "color": "#666666"
      }
    ]
  },
  {
    "featureType": "road.highway",
    "elementType": "labels.text",
    "stylers": [
      {
        "color": "#ffffff"
      }
    ]
  },
  {
    "featureType": "road.highway",
    "elementType": "labels.text.fill",
    "stylers": [
      {
        "color": "#ffffff"
      }
    ]
  },
  {
    "featureType": "road.highway",
    "elementType": "labels.text.stroke",
    "stylers": [
      {
        "color": "#000000"
      }
    ]
  },
  {
    "featureType": "road.local",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#999999"
      }
    ]
  },
  {
    "featureType": "road.local",
    "elementType": "geometry.stroke",
    "stylers": [
      {
        "color": "#999999"
      }
    ]
  },
  {
    "featureType": "road.local",
    "elementType": "labels.text.fill",
    "stylers": [
      {
        "color": "#ffffff"
      }
    ]
  },
  {
    "featureType": "road.local",
    "elementType": "labels.text.stroke",
    "stylers": [
      {
        "color": "#000000"
      }
    ]
  },
  {
    "featureType": "water",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      }
    ]
  }
]

Need your help guys! May the fourth be with you!

CurrentPlaceDetailsOnMap: task.isSuccessful issue on placeResult.addOnCompleteListener

I have just cloned the whole android-samples library and tried to run the CurrentPlaceDetailsOnMap project. I have done all the instructions given to me including creating my own API. However, everytime I just clicked Get Place, I get this error:

 com.google.android.gms.common.api.ApiException: 13: ERROR
 at com.google.android.gms.common.internal.zzb.zzx(Unknown Source)
 at com.google.android.gms.common.internal.zzbj.zzy(Unknown Source)
 at com.google.android.gms.common.internal.zzbk.zzp(Unknown Source)
 at com.google.android.gms.common.api.internal.zzs.zzc(Unknown Source)
 at com.google.android.gms.common.api.internal.zzs.setResult(Unknown Source)
 at com.google.android.gms.location.places.zzm.zzao(Unknown Source)
 at com.google.android.gms.location.places.internal.zzx.onTransact(Unknown Source)
 at android.os.Binder.execTransact(Binder.java:573)

I didn't change anything.

Direction API ?

Actually, i was looking for; how to use Google Directions in Google Map Android API as draw route between two points using this API. Do you write in any example about this ?

Runtime permissions

I (and I presume many others) would like to see a proper guidelines on how to manage runtime permissions for Google Maps with backwards compatibility.

About the EXTERNAL_STORAGE permissions with play services 8.4 onwards

Hi,

Do we require the EXTERNAL_STORAGE permission if we target the following config:

  • compileSdkVersion 23 (6.0)
  • buildToolsVersion 23+
  • Google Play Services SDK - 8.3+

My doubt arises because as per the AndroidManifest comment in this project, it mentions "EXTERNAL_STORAGE permissions are optional for Android 6.0 onwards." but the official documentation mentions that "you target version 8.3 or later of the Google Play services SDK, you no longer need the WRITE_EXTERNAL_STORAGE permission to use the Google Maps Android API."

Can we safely remove these two EXTERNAL_STORAGE permissions from the Manifest and expect the lower API versions to work without any side effects?

Thanks

Memory leak in Lite mode

There is a memory leak in LiteDemoActivity.

After opening LiteDemoActivity (clicking on "Lite Mode") and going back for n times you will get n leaked instances of LiteDemoActivity.

Permission request infinite loop

Project: CurrentPlaceDetailsOnMap
Emulator: Galaxy Nexus APi level 25
Android 7.1.1

Loop between:

private void updateLocationUI() {
        if (mMap == null) {
            return;
        }

        /*
         * Request location permission, so that we can get the location of the
         * device. The result of the permission request is handled by a callback,
         * onRequestPermissionsResult.
         */
        if (ContextCompat.checkSelfPermission(this.getApplicationContext(),
                android.Manifest.permission.ACCESS_FINE_LOCATION)
                == PackageManager.PERMISSION_GRANTED) {
            mLocationPermissionGranted = true;
        } else {
            ActivityCompat.requestPermissions(this,
                    new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
                    PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION);
        }

        if (mLocationPermissionGranted) {
            mMap.setMyLocationEnabled(true);
            mMap.getUiSettings().setMyLocationButtonEnabled(true);
        } else {
            mMap.setMyLocationEnabled(false);
            mMap.getUiSettings().setMyLocationButtonEnabled(false);
            mLastKnownLocation = null;
        }
    }

And

@Override
    public void onRequestPermissionsResult(int requestCode,
                                           @NonNull String permissions[],
                                           @NonNull int[] grantResults) {
        mLocationPermissionGranted = false;
        switch (requestCode) {
            case PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION: {
                // If request is cancelled, the result arrays are empty.
                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    mLocationPermissionGranted = true;
                }
            }
        }
        updateLocationUI();
    }

Log:

03-22 23:34:18.249 24660-24660/com.example.mypc.mapdemo W/Activity: Can reqeust only one set of permissions at a time
03-22 23:34:19.759 24660-24660/com.example.mypc.mapdemo W/Activity: Can reqeust only one set of permissions at a time
03-22 23:34:20.501 24660-24660/com.example.mypc.mapdemo W/Activity: Can reqeust only one set of permissions at a time
03-22 23:34:20.894 24660-24660/com.example.mypc.mapdemo W/Activity: Can reqeust only one set of permissions at a time

Crash

E/AndroidRuntime:     at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:372)
                                                       at com.example.mypc.mapdemo.MainActivity.updateLocationUI(MainActivity.java:330)
                                                       at com.example.mypc.mapdemo.MainActivity.onRequestPermissionsResult(MainActivity.java:207)
                                                       at android.app.Activity.requestPermissions(Activity.java:4116)
                                                       at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:372)
                                                       at com.example.mypc.mapdemo.MainActivity.updateLocationUI(MainActivity.java:330)
                                                       at com.example.mypc.mapdemo.MainActivity.onRequestPermissionsResult(MainActivity.java:207)
                                                       at android.app.Activity.requestPermissions(Activity.java:4116)
                                                       at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:372)
                                                       at com.example.mypc.mapdemo.MainActivity.updateLocationUI(MainActivity.java:330)
                                                       at com.example.mypc.mapdemo.MainActivity.onRequestPermissionsResult(MainActivity.java:207)
                                                       at android.app.Activity.requestPermissions(Activity.java:4116)
                                                       at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:372)
                                                       at com.example.mypc.mapdemo.MainActivity.updateLocationUI(MainActivity.java:330)
                                                       at com.example.mypc.mapdemo.MainActivity.onRequestPermissionsResult(MainActivity.java:207)
                                                       at android.app.Activity.requestPermissions(Activity.java:4116)
                                                       at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:372)
                                                       at com.example.mypc.mapdemo.MainActivity.updateLocationUI(MainActivity.java:330)
                                                       at com.example.mypc.mapdemo.MainActivity.onRequestPermissionsResult(MainActivity.java:207)
                                                       at android.app.Activity.requestPermissions(Activity.java:4116)
                                                       at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:372)
                                                       at com.example.mypc.mapdemo.MainActivity.updateLocationUI(MainActivity.java:330)
                                                       at com.example.mypc.mapdemo.MainActivity.onRequestPermissionsResult(MainActivity.java:207)
                                                       at android.app.Activity.requestPermissions(Activity.java:4116)
                                                       at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:372)
                                                       at com.example.mypc.mapdemo.MainActivity.updateLocationUI(MainActivity.java:330)
                                                       at com.example.mypc.mapdemo.MainActivity.onRequestPermissionsResult(MainActivity.java:207)
                                                       at android.app.Activity.requestPermissions(Activity.java:4116)
                                                       at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:372)
                                                       at com.example.mypc.mapdemo.MainActivity.updateLocationUI(MainActivity.java:330)
                                                       at com.example.mypc.mapdemo.MainActivity.onRequestPermissionsResult(MainActivity.java:207)
                                                       at android.app.Activity.requestPermissions(Activity.java:4116)
                                                       at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:372)
                                                       at com.example.mypc.mapdemo.MainActivity.updateLocationUI(MainActivity.java:330)
                                                       at com.example.mypc.mapdemo.MainActivity.onRequestPermissionsResult(MainActivity.java:207)
                                                       at android.app.Activity.requestPermissions(Activity.java:4116)
                                                       at android.support.v4.app.ActivityCompatApi23.requestPermissions(ActivityCompatApi23.java:49)
                                                       at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:37
```2)

Could not find com.google.android.gms:play-services-maps:8.4.0.

Am I missing a library ? If so what library and where do I obtain it from ?

A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.google.android.gms:play-services-maps:8.4.0.
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/android/gms/play-services-maps/8
.4.0/play-services-maps-8.4.0.pom
         https://jcenter.bintray.com/com/google/android/gms/play-services-maps/8
.4.0/play-services-maps-8.4.0.jar
         file:/C:/Users/Aaron/AppData/Local/Android/sdk2/extras/android/m2reposi
tory/com/google/android/gms/play-services-maps/8.4.0/play-services-maps-8.4.0.po
m
         file:/C:/Users/Aaron/AppData/Local/Android/sdk2/extras/android/m2reposi
tory/com/google/android/gms/play-services-maps/8.4.0/play-services-maps-8.4.0.ja
r
         file:/C:/Users/Aaron/AppData/Local/Android/sdk2/extras/google/m2reposit
ory/com/google/android/gms/play-services-maps/8.4.0/play-services-maps-8.4.0.pom

         file:/C:/Users/Aaron/AppData/Local/Android/sdk2/extras/google/m2reposit
ory/com/google/android/gms/play-services-maps/8.4.0/play-services-maps-8.4.0.jar

     Required by:
         ApiDemos:app:unspecified

Overlapping markers - on marker click - marker in the back is getting selected instead of the frontmost.

I have several markers close to each other on map, so much so that they sort of partially/fully overlap each other. I haven't specified any z-Index explicitly while adding the markers on the map, hence z-Index for all markers is 0.0 by default.

The problem is that when I tap on one of the overlapping markers which is at the frontmost position, the marker at the backmost is getting selected. So if there are 3 overlapping markers (say marker-1, marker-2, marker-3) one behind the other, marker-1 being at the front, marker-3 at the back and marker-2 is the middle of marker-1 & 2, when I click on marker-1, marker-3 gets selected instead. When I click again (on the same click point), marker-2 gets selected next, click again the third time, marker-1 gets selected finally.

At first, I thought there is probably a bug on my end or in the Google Maps library itself. After enough research online, I finally landed on google maps docs which doesn't quite answer my question.
From google-map API docs:- https://developers.google.com/maps/documentation/android-api/marker#marker_click_events

Clicking on a cluster of markers causes subsequent clicks to cycle through the cluster, selecting each in turn. The order of the cycle first prioritises z-index, then proximity to the click point.

(All marker's z-Indices are the same (0.0) in my case.)

On the other hand, when I checked on iOS (using iOS google maps library), I found the marker selection sequence to be correct (Marker-1 -> Marker-2 -> Marker-3) unlike Android which was the exact opposite.

Is this intended to be this way on Android? Or is it a Google Map library bug. Is there a way I could reverse the marker click sequence on Android like the way it's on iOS.

I know, one workaround could be to use marker clustering (ClusterManager etc) in such cases of overlapping markers, but I don't want to go that route for now.

Any comment will be highly appreciated.
Thanks.

Instant Run Problem

Hello,
I have problems with Instant Run and Google Maps,
the problems occur with any project, ApiDemos or Tutorials (in this case MapWithMarker).

To reproduce it just build and run the app, when it's open change something and do an instant run, for example in activity_maps.xml:
BEFORE

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.mapwithmarker.MapsMarkerActivity" />

AFTER:

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="300dp"
    tools:context="com.example.mapwithmarker.MapsMarkerActivity" />

ERROR:

08-16 11:51:24.820 11071-11123/com.example.mapwithmarker D/EGL_emulation: eglMakeCurrent: 0x9cb204a0: ver 2 0 (tinfo 0x9cb23b80)
08-16 11:51:24.853 11071-11071/com.example.mapwithmarker I/Google Maps Android API: Google Play services package version: 11302470
08-16 11:51:24.858 11071-11071/com.example.mapwithmarker W/ResourceType: For resource 0x7f07000e, entry index(14) is beyond type entryCount(1)
08-16 11:51:24.858 11071-11071/com.example.mapwithmarker W/ResourceType: Failure getting entry for 0x7f07000e (t=6 e=14) (error -75)
08-16 11:51:24.865 11071-11071/com.example.mapwithmarker D/AndroidRuntime: Shutting down VM
08-16 11:51:24.865 11071-11071/com.example.mapwithmarker E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.example.mapwithmarker, PID: 11071
                                                                           java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapwithmarker/com.example.mapwithmarker.MapsMarkerActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
                                                                               at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4519)
                                                                               at android.app.ActivityThread.-wrap19(ActivityThread.java)
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1483)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:154)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                                                                            Caused by: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment
                                                                            Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
                                                                            Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f07000e
                                                                               at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:190)
                                                                               at android.content.res.Resources.getDimensionPixelSize(Resources.java:667)
                                                                               at com.google.maps.api.android.lib6.impl.aq.i(:com.google.android.gms.DynamiteModulesB:69)
                                                                               at com.google.maps.api.android.lib6.impl.fj.<init>(:com.google.android.gms.DynamiteModulesB:19)
                                                                               at com.google.maps.api.android.lib6.impl.az.a(:com.google.android.gms.DynamiteModulesB:42)
                                                                               at com.google.maps.api.android.lib6.impl.az.a(:com.google.android.gms.DynamiteModulesB:1)
                                                                               at com.google.maps.api.android.lib6.impl.cl.a(:com.google.android.gms.DynamiteModulesB:24)
                                                                               at com.google.android.gms.maps.internal.s.onTransact(:com.google.android.gms.DynamiteModulesB:45)
                                                                               at android.os.Binder.transact(Binder.java:499)
                                                                               at com.google.android.gms.maps.internal.IMapFragmentDelegate$zza$zza.onCreateView(Unknown Source)
                                                                               at com.google.android.gms.maps.SupportMapFragment$zza.onCreateView(Unknown Source)
                                                                               at com.google.android.gms.dynamic.zza$4.zzb(Unknown Source)
                                                                               at com.google.android.gms.dynamic.zza.zza(Unknown Source)
                                                                               at com.google.android.gms.dynamic.zza.onCreateView(Unknown Source)
                                                                               at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
                                                                               at android.support.v4.app.Fragment.performCreateView(Fragment.java:2080)
                                                                               at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1065)
                                                                               at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1268)
                                                                               at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2442)
                                                                               at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:120)
                                                                               at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:376)
                                                                               at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:33)
                                                                               at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:75)
                                                                               at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
                                                                               at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
                                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
                                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
                                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                                                                               at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
                                                                               at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                               at com.example.mapwithmarker.MapsMarkerActivity.onCreate(MapsMarkerActivity.java:23)
                                                                               at android.app.Activity.performCreate(Activity.java:6679)
08-16 11:51:24.865 11071-11071/com.example.mapwithmarker E/AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
                                                                               at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4519)
                                                                               at android.app.ActivityThread.-wrap19(ActivityThread.java)
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1483)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:154)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Map crashing on jelly bean devices

Getting below errors on jelly bean devices

02-18 17:39:23.951 15029-15029/? E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.nb.a
02-18 17:39:24.098 15029-15029/? E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.mw.a

Same app crashing on android simulator
ava.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.activity.ShowLocationActivity}: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Api Demos is crashing

I am using a Micromax Canvas AndroidOne version phone and when i am running this app on my device it is crashing.

Error: File path too long on Windows, keep below 240 characters

After I download and building apk appear this error below:

Error:Error: File path too long on Windows, keep below 240 characters : C:\ThomasKanzigProjects\App\Android\Apps (examples)\android-samples-master\ApiDemos\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\10.2.0\res\drawable-xxhdpi-v4\common_google_signin_btn_icon_light_normal_background.9.png

What suppest I have to do?

Please update your google play service

I am trying to run this app. I have tried to follow the link on:
http://stackoverflow.com/questions/35476182/updating-google-play-services-in-emulator
and
http://stackoverflow.com/questions/35476182/updating-google-play-services-in-emulator

It still unable to solve the issue.

Below is my android studio settings. I am unable to figure out how my google play service can have 10.2.0 version. i have tried to reinstall the latest sdk, rebuild sync gradle, etc. I also have tried to downgrade the compile in gradle from 10.2.0 to 10.0.84 to match my android play version but it creates other issues having no reference to some of the functions used. I have spent 4hours trying to figure this out but having no results. can someone please help? Thanks.
image
image
image

image
image

Current Location

I'am chiness , I hava a problem , when I use this demo, "mLastKnownLocation" always equals null , so I can't get Latitude and Longitude, In my project , I only need Latitude and Longitude ,so I am not use Google Map , then cause this problem. ( mLastKnownLocation = LocationServices.FusedLocationApi
.getLastLocation(mGoogleApiClient); ) , I want you help me solve this problem , thank you!

clustering few markers

If I have less markers on my map for example if I have 3 or 4 markers they do not cluster together. Kindly guide me how can I make them to group together

centre of polygon has hole --> island

I couldn't fix this problem where I draw polygon and the centre of my polygon has island and the polygon just fill the colour of the small island. instead of I want that to be fill the whole things. I have tried multiple solutions : counter-clockwise , colour problem. is that possible if you answer for this. I have attached image on this post. thank you
screen shot 2016-07-14 at 9 58 18 am

There is no scaleControl in the map

Excuse me,I've found there is no API for showing Scale Control.As we know,scale is the most important performance on map,but I can't find the way to set it.Is it a Bug or it is not available to developer?

CurrentDetailsOnMap crashing when no places returned

Hello :)

If no places are returned, the app crashes when trying to show the dialog:

        // Display the dialog.
        AlertDialog dialog = new AlertDialog.Builder(this)
                .setTitle(R.string.pick_place)
                .setItems(mLikelyPlaceNames, listener)
                .show();

This is because mLikelyPlaceNames == null.

Maps Lite mode with incorrect zoom level first time app starts.

If you open map view lite mode, either liteDemoActivity or liteListDemo very first time the app is run, the maps comes with incorrect Zoom levels.

If you exit this screen and come back, you will see the maps with correct zoom level. Same issue on both lite Demo and liteList. In lite demo activity, click on Adelaide to see the difference.

Steps to reproduce :

  • Open the app, go to liteListDemo, observe the zoom level, now exit the screen by pressing back button.

  • Open the liteListDemo again and you should see maps with correct zoom level.

  • Kill the app from recent task, and open again to reproduce the issue.

Workaround for moveCamera to bounds

If I understand it right, moveCamera to bounds in onMapReady can cause crashes if the map layout is not ready.

Kind of workaround we can find in
android-samples/ApiDemos/app/src/main/java/com/example/mapdemo/MarkerDemoActivity.java

But not in
android-samples/ApiDemos/app/src/main/java/com/example/mapdemo/MarkerCloseInfoWindowOnRetapDemoActivity.java

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.