我从解析中提取动态数据并将坐标设置为谷歌地图作为标记,我的问题是,当点击自定义信息窗口时,我无法传递ID。
我想要的是在点击标记时显示用户个人资料的另一个意图。
我的代码:
ParseQuery<ParseObject> verifiedUsers = ParseQuery.getQuery("VerifiedUsers");
verifiedUsers.whereEqualTo("hideLocation", false);
verifiedUsers.whereEqualTo("isVerified", true);
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.whereNear("currentLocation", currentLocation);
query.whereEqualTo("emailVerified", true);
query.whereMatchesKeyInQuery("objectId", "userId", verifiedUsers);
query.whereWithinKilometers("currentLocation", currentLocation, 50);
query.findInBackground(new FindCallback<ParseUser>() {
@Override
public void done(List<ParseUser> users, ParseException e) {
// TODO Auto-generated method stub
if(e == null){
for(final ParseUser user: users){
ParseGeoPoint userLocation = (ParseGeoPoint) user.get("currentLocation");
LatLng position = new LatLng(userLocation.getLatitude(), userLocation.getLongitude());
Marker gMarker = googleMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_marker))
.anchor(0.0f, 1.0f) // Anchors the marker on the bottom left
.title(user.getString("name") + ", andrian")
.snippet("Position: " + user.getString("position"))
.position((position) ));
}
}
}
});
@Override
public void onInfoWindowClick(Marker marker) {
Toast.makeText(getActivity(), "User ID: " + iNeedIDHere, Toast.LENGTH_LONG).show();
}