0
在我的代碼,我有映射表活動的第一項活動展示製造商和第二活動顯示有關marker.In異步任務,我正在尋找一些位置和增加信息對象作爲標籤製造商的信息。就像我們做Marker.getTag()返回null
maker.setTag(obj);
當我上標記onMarkerclick點擊()被調用,我通過標記和第2活動啓動並顯示詳細信息
到這裏所有的東西工作正常調用getTag()得到OBJ。但是當我按下按鈕並再次單擊該標記時,它將從marker.getTag()返回null。以下是我的onMarkerClick方法
@Override
public boolean onMarkerClick(Marker marker) {
if (marker.getTag().toString().equals("JobSeeker")) {
// this is user current location show i dont want to do anything when marker is clicked
return false;
}
if (previousMarker != null && previousMarker.equals(marker)) {
//this code is executed if marker is clicked second time
LinkedTreeMap jobPost = (LinkedTreeMap) marker.getTag();
marker.setTag(jobPost);
Intent intent = new Intent(this, JobSearchResultActivity.class);
intent.putExtra("JobPost", jobPost);
Toast.makeText(this, "jobPostdetails" , Toast.LENGTH_SHORT).show();
startActivity(intent);
} else {
// just showing some toast that marker is selected
previousMarker = marker;
Toast.makeText(this, "selected" , Toast.LENGTH_SHORT).show();
marker.showInfoWindow();
}
return false;
}
請幫幫我。我不知道我在哪裏撥錯,也可能是一些愚蠢的錯誤