我是针对不同情况的3个标记。我想在所有3个标记上设置点击监听器(不在其标题上)以检查显示的标记。我实施了OnMarkerClickListener
和onMarkerClick
,但没有点击任何标记。我有什么遗失的吗?代码很长,所以只需检查onMarkerClick
方法的底部。
public class DriverMapFragmentActivity extends FragmentActivity implements
ConnectionCallbacks, OnConnectionFailedListener,ResultCallback<LocationSettingsResult>, OnMarkerClickListener{
private Marker userStoreMarker, storeMarker_, storeMarker_test;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.driver_map_page);
driver_arrived.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent1 = new Intent("com.nits.quick.cabapp_push");
intent1.putExtra("message", "cancel");
DriverMapFragmentActivity.this.sendBroadcast(intent1);
driver_arrived.setVisibility(View.GONE);
}
});
}
public void pssengerProfilePage(final HashMap<String, String> userdetailMap_) {
try {
if (userdetailMap_.get("from_user").equals("app")) {
addressAdminTV.setVisibility(View.VISIBLE);
addressAdminTV.setText(userdetailMap_.get("address"));
}else{
addressAdminTV.setVisibility(View.VISIBLE);
addressAdminTV.setText(userdetailMap_.get("address"));
driver_arrived.setVisibility(View.VISIBLE);
//driverArrivedAlertMessage("You have arrived.",getString(R.string.app_name));
}
passengerDetailDialog = new Dialog(this, R.style.PassDialogSlideAnim);
// set title
passengerDetailDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
passengerDetailDialog.setContentView(R.layout.passenger_profile_alert_page);
passengerDetailDialog.setCancelable(false);
passengerDetailDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
passengerDetailDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
CircleImageView pProfileImage = (CircleImageView)passengerDetailDialog.findViewById(R.id.p_notify_user_photo_imageView1);
TextView pNameVText = (TextView) passengerDetailDialog.findViewById(R.id.p_user_name_textView1);
TextView pAddressdVText = (TextView) passengerDetailDialog.findViewById(R.id.p_address__textView2);
TextView pPhoneVText = (TextView) passengerDetailDialog.findViewById(R.id.p_phone_no_textView3);
ImageView pCallMobileVText = (ImageView) passengerDetailDialog.findViewById(R.id.p_call_mobile_imageView3);
ImageView pSendSmsVText = (ImageView) passengerDetailDialog.findViewById(R.id.p_send_sms_imageView3);
LinearLayout pSendSmsViewLL= (LinearLayout) passengerDetailDialog.findViewById(R.id.p_send_sms_linearlayout);
pCancelTripText = (ImageView) passengerDetailDialog.findViewById(R.id.p_cancel_trip_imageView3);
if (userdetailMap_.get("from_user").equals("app")) {
pCancelTripText.setVisibility(View.VISIBLE);
}else{
pCancelTripText.setVisibility(View.INVISIBLE);
pSendSmsViewLL.setVisibility(View.INVISIBLE);
}
pNameVText.setText(userdetailMap_.get("pname"));
final String fullName = userdetailMap_.get("pname");
//pAddressdVText.setText(userdetailMap_.get("email"));
pPhoneVText.setText(userdetailMap_.get("mobile"));
//"tel:0377778888"
final String phoneNumber = "tel:"+userdetailMap_.get("mobile");
final String userId = userdetailMap_.get("id");
Log.e("POSTsPageFragment adapter", "userdetailMap_:"+userdetailMap_);
try {
String apiLink = userdetailMap_.get("image");
// Log.d("Profile", "apiLink:"+apiLink);
//String encodedurl = "";
//encodedurl = apiLink.substring(0,apiLink.lastIndexOf('/'))+ "/"+ Uri.encode(apiLink.substring(
//apiLink.lastIndexOf('/') + 1));
// Log.e("POSTsPageFragment adapter", "userdetailMap_:"+userdetailMap_);
if ( apiLink != null && !apiLink.equals("")) {
Picasso.with(this) // Context : con
.load(apiLink) // load: This path may be a remote URL,
.resize(100, 100)
.placeholder(R.drawable.default_user)
.error(R.drawable.default_user)
.into(pProfileImage); // Into: ImageView into which the final image has to be passed
}else{
pProfileImage.setImageResource(R.drawable.default_user);
}
} catch (Exception e) {
// TODO: handle exception
}
pCallMobileVText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse(phoneNumber));
startActivity(callIntent);
}
});
pSendSmsVText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//Log.d("DiverMapPage", "driver userId:"+userId);
Bundle bundle = new Bundle();
String name = userdetailMap.get("fname")+" "+userdetailMap.get("lname");
bundle.putSerializable("userId", userdetailMap.get("id"));
bundle.putSerializable("userName", name);
bundle.putSerializable("opponentName", fullName);
bundle.putSerializable("callFrom", "driver");
bundle.putSerializable("opponentID", userId);
// Open chat activity
QuickCabChatActivity.start(DriverMapFragmentActivity.this, bundle);
}
});
//Log.d("Profile", "userdetailMap_:"+userdetailMap_);
pCancelTripText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//Cancel trip
String params = "action=cancelJobDriver&j_id="+userdetailMap_.get("jobid");
DriverCancelTripTask driverCancelTrio = new DriverCancelTripTask();
driverCancelTrio.execute(params);
passengerDetailDialog.dismiss();
}
});
// titleVText.setText(title);
// TextView tvText = (TextView) dialog.findViewById(R.id.mail_id_textView2);
//tvText.setText(message);
ImageView closedialog = (ImageView) passengerDetailDialog.findViewById(R.id.profile_page_close_imageView1);
closedialog.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// Do your stuff...
passengerDetailDialog.dismiss();
}
});
passengerDetailDialog.show();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
@Override
public boolean onMarkerClick(Marker marker) {
if (marker.equals(userStoreMarker)){
System.out.println("userStoreMarker");
}else if(marker.equals(storeMarker_)){
System.out.println("storeMarker_");
}else if(marker.equals(storeMarker_test)){
System.out.println("storeMarker_test");
}
return true;
}
}
&#13;
答案 0 :(得分:1)
您需要将标记点击侦听器设置为地图:
video_row = soupdata.find_all('body')