Java Code Examples for com.google.android.gms.maps.model.Marker#getTitle()

The following examples show how to use com.google.android.gms.maps.model.Marker#getTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomInfoWindowAdapter.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 6 votes vote down vote up
private void render(Marker marker, View view)
{
	int badge;
	if (marker.equals(brisbane))
	{
		badge = R.drawable.brisbane;
	} else if (marker.equals(adelaide))
	{
		badge = R.drawable.adelaide;
	} else
	{
		// Passing 0 to setImageResource will clear the image view.
		badge = 0;
	}
	((ImageView) view.findViewById(R.id.badge)).setImageResource(badge);

	String title = marker.getTitle();
	TextView tvTitle = view.findViewById(R.id.tvTitle);
	tvTitle.setText(title);

	String snippet = marker.getSnippet();
	TextView tvSnippet = view.findViewById(R.id.tvSnippet);
	tvSnippet.setText(snippet);
}
 
Example 2
Source File: AtlasFragment.java    From memoir with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker) {
    String title = marker.getTitle();
    for (int i = 0; i < noteList.size(); i++) {
        if (noteList.get(i).title.equals(title)) {
            Intent intent = new Intent(getActivity(), ViewActivity.class);
            intent.putExtra(ViewActivity.ACTION_TYPE_KEY, ViewActivity.ACTION_TYPE_EDIT);
            intent.putExtra(ViewActivity.NOTE_ID_KEY, noteList.get(i).id);
            startActivity(intent);
        }
    }
    return false;
}
 
Example 3
Source File: CampusMapActivity.java    From utexas-utilities with Apache License 2.0 5 votes vote down vote up
@Override
public View getInfoContents(Marker marker) {
    String title = marker.getTitle();
    String snippet = marker.getSnippet();
    if (!infoTitle.getText().equals(title)) {
        // Span for bolding the title
        SpannableString styledTitle = new SpannableString(title);
        styledTitle.setSpan(new StyleSpan(Typeface.BOLD), 0, title.length(), 0);

        infoTitle.setText(styledTitle);
        infoSnippet.setText(snippet);
    }
    return infoLayout;
}
 
Example 4
Source File: MarkerDemoActivity.java    From android-samples with Apache License 2.0 4 votes vote down vote up
private void render(Marker marker, View view) {
    int badge;
    // Use the equals() method on a Marker to check for equals.  Do not use ==.
    if (marker.equals(mBrisbane)) {
        badge = R.drawable.badge_qld;
    } else if (marker.equals(mAdelaide)) {
        badge = R.drawable.badge_sa;
    } else if (marker.equals(mSydney)) {
        badge = R.drawable.badge_nsw;
    } else if (marker.equals(mMelbourne)) {
        badge = R.drawable.badge_victoria;
    } else if (marker.equals(mPerth)) {
        badge = R.drawable.badge_wa;
    } else if (marker.equals(mDarwin1)) {
        badge = R.drawable.badge_nt;
    } else if (marker.equals(mDarwin2)) {
        badge = R.drawable.badge_nt;
    } else if (marker.equals(mDarwin3)) {
        badge = R.drawable.badge_nt;
    } else if (marker.equals(mDarwin4)) {
        badge = R.drawable.badge_nt;
    } else {
        // Passing 0 to setImageResource will clear the image view.
        badge = 0;
    }
    ((ImageView) view.findViewById(R.id.badge)).setImageResource(badge);

    String title = marker.getTitle();
    TextView titleUi = ((TextView) view.findViewById(R.id.title));
    if (title != null) {
        // Spannable string allows us to edit the formatting of the text.
        SpannableString titleText = new SpannableString(title);
        titleText.setSpan(new ForegroundColorSpan(Color.RED), 0, titleText.length(), 0);
        titleUi.setText(titleText);
    } else {
        titleUi.setText("");
    }

    String snippet = marker.getSnippet();
    TextView snippetUi = ((TextView) view.findViewById(R.id.snippet));
    if (snippet != null && snippet.length() > 12) {
        SpannableString snippetText = new SpannableString(snippet);
        snippetText.setSpan(new ForegroundColorSpan(Color.MAGENTA), 0, 10, 0);
        snippetText.setSpan(new ForegroundColorSpan(Color.BLUE), 12, snippet.length(), 0);
        snippetUi.setText(snippetText);
    } else {
        snippetUi.setText("");
    }
}