嵌套循环只运行两次

时间:2017-08-25 07:42:45

标签: android

请帮帮我。内循环只运行两次0和1.如何在外循环多次运行循环,然后内循环也运行多次。怎么样?

if (result != null && result.size() > 0) {

            for (int i = 0;i < result.size(); i++) {
                data= result.get(i);
                // j=i;
                uLocations = data.getULocations();
                    for (int j = 0; j <  uLocations.size(); j++) {
                        //location = userLocations.get(j);
                        Log.e(TAG, "Maps Activity  " +  uLocations);
                        // location= uLocations.get(j);
                        //UserLocation  uLocations=   uLocations.get(j);

                        // data=result.get(j).getULocations();
                        LatLng ll = new   LatLng(Double.parseDouble(uLocations.get(j).getLatitude())
                                ,    Double.parseDouble(uLocations.get(j).getLongitude()));

                        mMap.addMarker(new MarkerOptions().position(ll).title(uLocations.get(j).getName() + " " +
                                data.getUsername()).snippet(uLocations.get(j).getAddress()));

                        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Double.parseDouble(uLocations.get(j).getLatitude())
                                ,    Double.parseDouble(uLocations.get(j).getLongitude())), 14.0f));

                    }

                           listOfZ.add(String.valueOf(result.get(i).getId()));
                    // uLocations.add(location);
                    //Data object=new Data(this, (ArrayList< Data >) result);
                    //result.add(object);


            }

0 个答案:

没有答案