NavigationViewForAuto

public final class NavigationViewForAuto extends FrameLayout

A View which displays a map for navigation in Android Auto.

Users of this class must forward all the life cycle methods from the Activity or Fragment containing this view to the corresponding ones in this class. In particular, you must forward on the following methods:

If the NavigationViewForAuto is added after its parent Activity or Fragment has been through its creation lifecycle, you must call onCreate(Bundle), onStart() and onResume() manually to properly initialize it. Similarly, if a NavigationViewForAuto is detached from its parent Activity or Fragment, you must manually call onPause(), onStop() and onDestroy() to prevent leaks.

Note: Adding children to this view is not supported.

All calls to NavigationViewForAuto should be performed on the UI thread.

Inherited Constant Summary

Inherited Field Summary

Public Constructor Summary

NavigationViewForAuto(Context context)
NavigationViewForAuto(Context context, GoogleMapOptions googleMapOptions)
NavigationViewForAuto(Context context, AttributeSet attrs)
NavigationViewForAuto(Context context, AttributeSet attrs, GoogleMapOptions googleMapOptions)
Constructs a navigation view instance for Android Auto.
NavigationViewForAuto(Context context, AttributeSet attrs, int defStyleAttr)
NavigationViewForAuto(Context context, AttributeSet attrs, int defStyleAttr, GoogleMapOptions googleMapOptions)
Constructs a navigation view instance for Android Auto.

Public Method Summary

void
addView(View child, int index)
void
addView(View child, ViewGroup.LayoutParams params)
void
addView(View child)
void
addView(View child, int index, ViewGroup.LayoutParams params)
void
addView(View child, int width, int height)
void
getMapAsync(OnMapReadyCallback mapReadyCallback)
Returns a non-null instance of the GoogleMap, ready to be used.
void
onConfigurationChanged(Configuration config)
void
onCreate(Bundle savedInstanceState)
void
void
void
void
onSaveInstanceState(Bundle outState)
void
void
onStop()
void
onTrimMemory(int level)

Inherited Method Summary

Public Constructors

public NavigationViewForAuto (Context context)

Parameters
context

public NavigationViewForAuto (Context context, GoogleMapOptions googleMapOptions)

Parameters
context
googleMapOptions

public NavigationViewForAuto (Context context, AttributeSet attrs)

Parameters
context
attrs

public NavigationViewForAuto (Context context, AttributeSet attrs, GoogleMapOptions googleMapOptions)

Constructs a navigation view instance for Android Auto.

Note: Navigation SDK automatically disables the compass icon for Android Auto, regardless of the value you provide in GoogleMapOptions.compassEnabled(boolean).

Parameters
context
attrs
googleMapOptions

public NavigationViewForAuto (Context context, AttributeSet attrs, int defStyleAttr)

Parameters
context
attrs
defStyleAttr

public NavigationViewForAuto (Context context, AttributeSet attrs, int defStyleAttr, GoogleMapOptions googleMapOptions)

Constructs a navigation view instance for Android Auto.

Note: Navigation SDK automatically disables the compass icon for Android Auto, regardless of the value you provide in GoogleMapOptions.compassEnabled(boolean).

Parameters
context
attrs
defStyleAttr
googleMapOptions

Public Methods

public void addView (View child, int index)

Parameters
child
index

public void addView (View child, ViewGroup.LayoutParams params)

Parameters
child
params

public void addView (View child)

Parameters
child

public void addView (View child, int index, ViewGroup.LayoutParams params)

Parameters
child
index
params

public void addView (View child, int width, int height)

Parameters
child
width
height

public void getMapAsync (OnMapReadyCallback mapReadyCallback)

Returns a non-null instance of the GoogleMap, ready to be used.

Note that:

  • This method must be called from the main thread.
  • The callback is executed in the main thread.
  • The GoogleMap object provided by the callback is non-null.

Parameters
mapReadyCallback The callback object triggered when the map is ready to be used.

public void onConfigurationChanged (Configuration config)

Parameters
config

public void onCreate (Bundle savedInstanceState)

Parameters
savedInstanceState

public void onDestroy ()

public void onPause ()

public void onResume ()

public void onSaveInstanceState (Bundle outState)

Parameters
outState

public void onStart ()

public void onStop ()

public void onTrimMemory (int level)

Parameters
level