Created
December 25, 2015 14:03
-
-
Save smellman/ab5bb01c830dc3d8a719 to your computer and use it in GitHub Desktop.
Mapbox Android SDK (mapbox-gl-native) MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.smellman.mapboxandroidsdktest | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import com.mapbox.mapboxsdk.geometry.LatLng | |
import com.mapbox.mapboxsdk.views.MapView | |
import kotlin.properties.Delegates | |
class MainActivity : AppCompatActivity() { | |
var mv: MapView by Delegates.notNull<MapView>() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
mv = findViewById(R.id.mapview) as MapView | |
mv.styleUrl = "https://gist.githubusercontent.com/smellman/494dbd3868ca6a8f3b41/raw/91a7ca5467315d0346e452de103302fa73cf9661/json" | |
mv.centerCoordinate = LatLng(35.362222, 138.731389) | |
mv.zoomLevel = 11.0 | |
mv.onCreate(savedInstanceState) | |
} | |
override fun onStart() { | |
super.onStart() | |
mv.onStart() | |
} | |
override fun onResume() { | |
super.onResume() | |
mv.onResume() | |
} | |
override fun onPause() { | |
super.onPause() | |
mv.onPause() | |
} | |
override fun onStop() { | |
super.onStop() | |
mv.onStop() | |
} | |
override fun onDestroy() { | |
super.onDestroy() | |
mv.onDestroy() | |
} | |
override fun onSaveInstanceState(outState: Bundle?) { | |
super.onSaveInstanceState(outState) | |
mv.onSaveInstanceState(outState) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment