Bản đồ đơn giản

Hiển thị bản đồ trong ứng dụng của bạn bằng cách sử dụng Vietbando Android SDK.

Ví dụ này cần một tập tin thứ hai là: activity_main.xml.
import android.app.Activity;
import android.os.Bundle;

import com.vietbando.vietbandosdk.maps.MapView;
import com.vietbando.vietbandosdk.maps.vietbandoMap;
import com.vietbando.vietbandosdk.maps.OnMapReadyCallback;

public class MainActivity extends Activity {

    private MapView mapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mapView = (MapView) findViewById(R.id.mapView);
        mapView.onCreate(savedInstanceState);
        mapView.getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(VietbandoMap VietbandoMap) {

                // Customize map with markers, polylines, etc.
            }
        });
    }

    // Add the mapView lifecycle to the activity's lifecycle methods
    @Override
    public void onResume() {
        super.onResume();
        mapView.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
        mapView.onPause();
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        mapView.onLowMemory();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mapView.onDestroy();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        mapView.onSaveInstanceState(outState);
    }
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                xmlns:vietbando="http://schemas.android.com/apk/res-auto"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context=".MainActivity">

                <!-- Set the starting camera position and map style using xml-->
                <com.vietbando.vietbandosdk.maps.MapView
                    android:id="@+id/mapView"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    vietbando:access_token="<your access token here>"                    
                    vietbando:center_latitude="10.7773973"
                    vietbando:center_longitude="106.701278"
                    vietbando:zoom="11"/>

</RelativeLayout>