小编Tey*_*Lan的帖子

如何在Android中使用群集算法时使用标记标记

        Marker marker = mMap.addMarker(markerOptions);
        marker.setTag(poi.getKey());
        marker.hideInfoWindow();
        builder.include(marker.getPosition()); 
Run Code Online (Sandbox Code Playgroud)

这段代码正常,因为我把manuel作为manuel.我做了一切marker.tag().我使用哈希键来重新检查我的引脚.

mClusterManager.addItem() 我想用这个方法.但我也想拿标记标记.所以我不想添加到地图中Marker marker = mMap.addMarker(markerOptions);

我怎么解决这个问题?

我想解释更多细节.

public class PoiItem implements ClusterItem{
private final LatLng mPosition;
private String mTitle;
private String mSnippet;
private String tag;
private ResponsePoi pois;

public PoiItem(ResponsePoi poi,double lat, double lng,String tag) {
    mPosition = new LatLng(lat, lng);
    pois = poi;
    mTitle = poi.getName();
    mSnippet = poi.getAddress();
    this.tag = tag;
}


 private void setMyCluster(){
        mClusterManager = new ClusterManager<PoiItem>         (MainActivity.this,mMap);
        mMap.setOnCameraIdleListener(mClusterManager);
        mMap.setOnMarkerClickListener(mClusterManager);
    }

    setMyCluster();
    for(HashMap.Entry<String, ResponsePoi> poi …
Run Code Online (Sandbox Code Playgroud)

android google-maps dictionary cluster-computing marker

7
推荐指数
1
解决办法
1618
查看次数

Activity在后台时如何接收eventbus事件

我想使用 Firebase 通知服务获取通知消息。我正在从 Firebase 发送消息,没关系。

如果用户运行,我想收到此通知,MainActivity我也想使用对话框显示弹出窗口。

如果用户运行其他活动,例如SettingActivityProfileActivity,通知处理无论如何,用户运行MainActivity弹出窗口突然出现。

为此,我使用 Greenbot Eventbus。当我在里面MainActivity并且通知来时它出现所以它可以。但是当我在里面时,另一个Activity通知没有来。

如何处理这个消息直到来MainActivity

public class NotificationService  extends FirebaseMessagingService {
    private static final String TAG = "evenBus" ;

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);


        Log.d(TAG, "onMessageReceived");
        // Check if message contains a notification payload.
        if (remoteMessage.getNotification() != null) {
            // do nothing if Notification message is received
            Log.d(TAG, "Message data payload: " + remoteMessage.getNotification().getBody());
            String body = remoteMessage.getNotification().getBody(); …
Run Code Online (Sandbox Code Playgroud)

notifications android firebase greenrobot-eventbus firebase-notifications

3
推荐指数
1
解决办法
2374
查看次数