Class Info |
|---|
public class SupportMapFragment Map component in an app, which can be used to add a map to the app in the simplest way. To obtain the map manager, call getMapAsync. The HuaweiMap object must be obtained using getMapAsync(OnMapReadyCallback callback). This class will automatically initialize the map system and view. Any object obtained from HuaweiMap will be associated with the view. Do not save objects (such as markers) out of the view's lifecycle. Otherwise, memory leaks will occur because the view cannot be released. |
Constructor Name |
|---|
SupportMapFragment() Default constructor of the SupportMapFragment class. |
Qualifier and Type | Method Name and Description |
|---|---|
void | getMapAsync(OnMapReadyCallback callback) Obtains a HuaweiMap object when the object is ready. |
static SupportMapFragment | newInstance(HuaweiMapOptions options) Creates a SupportMapFragment object with specified attributes. |
static SupportMapFragment | Creates a SupportMapFragment object with default attributes. |
void | onActivityCreated(Bundle savedInstanceState) Lifecycle method inherited from Fragment. |
void | onAttach(Activity activity) Lifecycle method inherited from Fragment. |
void | onCreate(Bundle savedInstanceState) Lifecycle method inherited from Fragment. |
View | onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) Lifecycle method inherited from Fragment. |
void | Lifecycle method inherited from Fragment. |
void | Lifecycle method inherited from Fragment. |
void | onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) Lifecycle method inherited from Fragment. This method is called when SupportMapFragment is statically loaded in XML mode. |
void | Lifecycle method inherited from Fragment. |
void | onPause() Lifecycle method inherited from Fragment. |
void | onResume() Lifecycle method inherited from Fragment. |
void | onSaveInstanceState(Bundle outState) Lifecycle method inherited from Fragment and called when Fragment is destroyed unexpectedly. It is used to save the status of a SupportMapFragment object before it is destroyed. Then, the status can be retrieved when onCreate(Bundle) is called again. |
void | onStart() Lifecycle method inherited from Fragment. |
void | onStop() Lifecycle method inherited from Fragment. |
void | setArguments(Bundle args) Lifecycle method inherited from Fragment and called when data needs to be passed to Fragment. |
Method |
|---|
public void getMapAsync(OnMapReadyCallback callback) Obtains a HuaweiMap object when the object is ready. |
Parameters
Name | Description |
|---|---|
callback | Callback to be executed when a map is ready for use. |
Method |
|---|
public static SupportMapFragment newInstance(HuaweiMapOptions options) Creates a SupportMapFragment object with specified attributes. |
Parameters
Name | Description |
|---|---|
options | Attributes required for creating a SupportMapFragment object. |
Returns
Type | Description |
|---|---|
SupportMapFragment | SupportMapFragment object. |
Method |
|---|
public static SupportMapFragment newInstance() Creates a SupportMapFragment object with default attributes. |
Returns
Type | Description |
|---|---|
SupportMapFragment | SupportMapFragment object. |
Method |
|---|
public void onActivityCreated(Bundle savedInstanceState) Lifecycle method inherited from Fragment. |
Parameters
Name | Description |
|---|---|
savedInstanceState | Status to be saved for a SupportMapFragment object. |
Method |
|---|
public void onAttach(Activity activity) Lifecycle method inherited from Fragment. |
Parameters
Name | Description |
|---|---|
activity | Activity object bound to SupportMapFragment. |
Method |
|---|
public void onCreate(Bundle savedInstanceState) Lifecycle method inherited from Fragment. |
Parameters
Name | Description |
|---|---|
savedInstanceState | Status to be saved for a SupportMapFragment object. |
Method |
|---|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) Lifecycle method inherited from Fragment. |
Parameters
Name | Description |
|---|---|
inflater | LayoutInflater object, which is used to search for controls in a layout. |
container | Layout container. |
savedInstanceState | Status to be saved for a SupportMapFragment object. |
Returns
Type | Description |
|---|---|
View | View object. |
Method |
|---|
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) Lifecycle method inherited from Fragment. This method is called when SupportMapFragment is statically loaded in XML mode. |
Parameters
Name | Description |
|---|---|
activity | Activity object bound to SupportMapFragment. |
attrs | Attributes used to create a SupportMapFragment object. |
savedInstanceState | Status to be saved for a SupportMapFragment object. |
Method |
|---|
public void onSaveInstanceState(Bundle outState) Method inherited from Fragment and called when Fragment is destroyed unexpectedly. It is used to save the status of a SupportMapFragment object before it is destroyed. Then, the status can be retrieved when onCreate(Bundle) is called again. |
Parameters
Name | Description |
|---|---|
outState | Status to be saved for a SupportMapFragment object. |