Loading app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ android { buildToolsVersion "29.0.2" defaultConfig { applicationId "pw.cyberbrain.penzatransport" minSdkVersion 23 minSdkVersion 18 targetSdkVersion 29 versionCode 1 versionName "1.0" Loading app/src/main/java/pw/cyberbrain/penzatransport/MainActivity.java +22 −4 Original line number Diff line number Diff line Loading @@ -2,6 +2,12 @@ package pw.cyberbrain.penzatransport; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import com.yandex.mapkit.Animation; import com.yandex.mapkit.MapKitFactory; import com.yandex.mapkit.geometry.Point; import com.yandex.mapkit.map.CameraPosition; import com.yandex.mapkit.mapview.MapView; public class MainActivity extends AppCompatActivity { Loading @@ -15,13 +21,25 @@ public class MainActivity extends AppCompatActivity { MapKitFactory.initialize(this); // Укажите имя activity вместо map. setContentView(R.layout.MainActivity); mapview = (MapView)findViewById(R.id.mapview); setContentView(R.layout.activity_main); mapview = findViewById(R.id.mapview); mapview.getMap().move( new CameraPosition(new Point(55.751574, 37.573856), 11.0f, 0.0f, 0.0f), new CameraPosition(new Point(55.751574, 37.573856), 5.0f, 0.0f, 0.0f), new Animation(Animation.Type.SMOOTH, 0), null); } setContentView(R.layout.activity_main); @Override protected void onStart() { super.onStart(); mapview.onStart(); MapKitFactory.getInstance().onStart(); } @Override protected void onStop() { super.onStop(); mapview.onStop(); MapKitFactory.getInstance().onStop(); } } app/src/main/res/layout/activity_main.xml +3 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> Loading @@ -20,6 +19,8 @@ <com.yandex.mapkit.mapview.MapView android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent"/> android:layout_height="match_parent" tools:layout_editor_absoluteX="131dp" tools:layout_editor_absoluteY="166dp" /> </androidx.constraintlayout.widget.ConstraintLayout> No newline at end of file Loading
app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ android { buildToolsVersion "29.0.2" defaultConfig { applicationId "pw.cyberbrain.penzatransport" minSdkVersion 23 minSdkVersion 18 targetSdkVersion 29 versionCode 1 versionName "1.0" Loading
app/src/main/java/pw/cyberbrain/penzatransport/MainActivity.java +22 −4 Original line number Diff line number Diff line Loading @@ -2,6 +2,12 @@ package pw.cyberbrain.penzatransport; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import com.yandex.mapkit.Animation; import com.yandex.mapkit.MapKitFactory; import com.yandex.mapkit.geometry.Point; import com.yandex.mapkit.map.CameraPosition; import com.yandex.mapkit.mapview.MapView; public class MainActivity extends AppCompatActivity { Loading @@ -15,13 +21,25 @@ public class MainActivity extends AppCompatActivity { MapKitFactory.initialize(this); // Укажите имя activity вместо map. setContentView(R.layout.MainActivity); mapview = (MapView)findViewById(R.id.mapview); setContentView(R.layout.activity_main); mapview = findViewById(R.id.mapview); mapview.getMap().move( new CameraPosition(new Point(55.751574, 37.573856), 11.0f, 0.0f, 0.0f), new CameraPosition(new Point(55.751574, 37.573856), 5.0f, 0.0f, 0.0f), new Animation(Animation.Type.SMOOTH, 0), null); } setContentView(R.layout.activity_main); @Override protected void onStart() { super.onStart(); mapview.onStart(); MapKitFactory.getInstance().onStart(); } @Override protected void onStop() { super.onStop(); mapview.onStop(); MapKitFactory.getInstance().onStop(); } }
app/src/main/res/layout/activity_main.xml +3 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> Loading @@ -20,6 +19,8 @@ <com.yandex.mapkit.mapview.MapView android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent"/> android:layout_height="match_parent" tools:layout_editor_absoluteX="131dp" tools:layout_editor_absoluteY="166dp" /> </androidx.constraintlayout.widget.ConstraintLayout> No newline at end of file