Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 意图(MapFeeds.this,PhotoView.class); intent.putExtra(“objectId”,post.getObjectId()); intent.putExtra(“photo”,String.valueOf(post.g_Android_Google Maps_Parse Platform - Fatal编程技术网

Android 意图(MapFeeds.this,PhotoView.class); intent.putExtra(“objectId”,post.getObjectId()); intent.putExtra(“photo”,String.valueOf(post.g

Android 意图(MapFeeds.this,PhotoView.class); intent.putExtra(“objectId”,post.getObjectId()); intent.putExtra(“photo”,String.valueOf(post.g,android,google-maps,parse-platform,Android,Google Maps,Parse Platform,意图(MapFeeds.this,PhotoView.class); intent.putExtra(“objectId”,post.getObjectId()); intent.putExtra(“photo”,String.valueOf(post.getPhoto().getUrl()); intent.putExtra(“userId”,post.getUserId()); intent.putExtra(“objectId”,post.getObjectId()); 星触觉(意向);

意图(MapFeeds.this,PhotoView.class); intent.putExtra(“objectId”,post.getObjectId()); intent.putExtra(“photo”,String.valueOf(post.getPhoto().getUrl()); intent.putExtra(“userId”,post.getUserId()); intent.putExtra(“objectId”,post.getObjectId()); 星触觉(意向); 返回false; } }); } } }); }
        mHandler.postDelayed(new Runnable() {
            public void run() {
                onResume();
            }
        }, 3000);
        mylocation = MainActivity.mlastlocation;
        // Gets to GoogleMap from the MapView and does initialization stuff
        mapFragment.getMap().setMyLocationEnabled(true);
        // Enable the current location "blue dot"
        mapFragment.getMap().setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
                  public void onCameraChange(CameraPosition position) {

        if (mylocation == null) {
            Toast.makeText(MapFeedsFragment.this, "null", Toast.LENGTH_SHORT).show();
        }
        if (mylocation != null)
            Toast.makeText(MapFeedsFragment.this, "not null", Toast.LENGTH_SHORT).show();
                      ParseMap aroundposts = new ParseMap();
        doMapQuery();
        }
            });
    }

    private ParseGeoPoint geoPointFromLocation(Location location) {
        latitude = location.getLatitude();
        longitude = location.getLongitude();
        ParseGeoPoint myloc = new ParseGeoPoint(latitude, longitude);
        return myloc;
    }



    private void doMapQuery() {
        final int myUpdateNumber = ++mostRecentMapUpdate;
        //Location myLoc = (currentLocation == null) ? lastLocation : currentLocation;
        // If location info isn't available, clean up any existing markers
        if (mylocation == null) {
            cleanUpMarkers(new HashSet<String>());
            return;
        }
        final ParseGeoPoint myPoint = geoPointFromLocation(mylocation);
        // Create the map Parse query
        ParseQuery<ParseMap> mapQuery = ParseMap.getQuery();
        // Set up additional query filters
        //mapQuery.whereWithinKilometers("location", myPoint, MAX_POST_SEARCH_DISTANCE);
        mapQuery.include("user");
        mapQuery.orderByDescending("createdAt");
        //mapQuery.setLimit(MAX_POST_SEARCH_RESULTS);
        // Kick off the query in the background
        mapQuery.findInBackground(new FindCallback<ParseMap>() {
            @Override
            public void done(List<ParseMap> objects, ParseException e) {
                if (e != null) {
                    //if (Application.APPDEBUG) {
                    //  Log.d(Application.APPTAG, "An error occurred while querying for map posts.", e);
                    //}
                    return;
                }
        /*
         * Make sure we're processing results from
         * the most recent update, in case there
         * may be more than one in progress.
         */
                if (myUpdateNumber != mostRecentMapUpdate) {
                    return;
                }
                // Posts to show on the map
                Set<String> toKeep = new HashSet<String>();
                // Loop through the results of the search
                for (final ParseMap post : objects) {
                    // Add this post to the list of map pins to keep
                    toKeep.add(post.getObjectId());
                    // Check for an existing marker for this post
                    Marker oldMarker = mapMarkers.get(post.getObjectId());
                    // Set up the map marker's location
                    String uri = post.getPhotoThumb().getUrl();
                   // final MarkerOptions finalMarkerOpts = markerOpts;
                    Picasso.with(MapFeedsFragment.this)
                            .load(uri)
                            .resize(100,100)
                            .centerCrop()
                            .into(new Target() {
                                @Override
                                public void onBitmapLoaded(final Bitmap bitmap, Picasso.LoadedFrom from) {
            /* Save the bitmap or do something with it here */

                                    final MarkerOptions markerOpts =
                                            new MarkerOptions().position(new LatLng(post.getLocation().getLatitude(), post
                                                    .getLocation().getLongitude())).icon(BitmapDescriptorFactory.fromBitmap(bitmap)).title(post.getUser());
                                    // Add a new marker
                                    Marker marker = mapFragment.getMap().addMarker(markerOpts);
                                    mapMarkers.put(post.getObjectId(), marker);
                                    mapMarkers.put(post.getVideo().getUrl(),marker);
                                    mapMarkers.put(post.getUserId(),marker);

                                    mapMarkers.put(String.valueOf(post.getViews()),marker);

                                }

                                @Override
                                public void onBitmapFailed(Drawable errorDrawable) {

                                }

                                @Override
                                public void onPrepareLoad(Drawable placeHolderDrawable) {

                                }
                            });



                        mapFragment.getMap().setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {

                            @Override
                        public boolean onMarkerClick(Marker marker) {
                            Intent intent = new Intent (MapFeeds.this,PhotoView.class);
                                intent.putExtra("objectId",post.getObjectId());
                                intent.putExtra("photo", String.valueOf(post.getPhoto().getUrl()));
                            intent.putExtra("userId",post.getUserId());
                            intent.putExtra("objectId",post.getObjectId());

                            startActivity(intent);
                            return false;
                        }
                    });
                }
            }
        });
    }