diff --git a/app/build.gradle b/app/build.gradle
index 7c8f3cd..30ae651 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,15 +1,16 @@
plugins {
id 'com.android.application'
+ id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
android {
namespace 'com.example.oplogy'
- compileSdk 33
+ compileSdk 34
defaultConfig {
applicationId "com.example.oplogy"
minSdk 26
- targetSdk 33
+ targetSdk 34
versionCode 1
versionName "1.0"
@@ -26,6 +27,9 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
+ buildFeatures {
+ viewBinding true
+ }
}
dependencies {
@@ -33,6 +37,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation 'com.google.android.gms:play-services-maps:18.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f1bbbad..a476460 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -12,6 +12,33 @@
android:supportsRtl="true"
android:theme="@style/Theme.Oplogy"
tools:targetApi="31">
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/example/oplogy/MainActivity.java b/app/src/main/java/com/example/oplogy/MainActivity.java
index f16d9aa..6db2fa5 100644
--- a/app/src/main/java/com/example/oplogy/MainActivity.java
+++ b/app/src/main/java/com/example/oplogy/MainActivity.java
@@ -20,19 +20,18 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- button = findViewById(R.id.button1);
- button.setOnClickListener(this);
- editText = findViewById(R.id.textview1);
+
+ findViewById(R.id.mapmapcreate).setOnClickListener(
+ view->{
+
+
+ }
+ );
}
-
-
-
- @Override
+ @Override
public void onClick(View v) {
- if (v == button){
- editText.setText("押した");
- }
+
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/oplogy/MapsActivity.java b/app/src/main/java/com/example/oplogy/MapsActivity.java
new file mode 100644
index 0000000..51d8b34
--- /dev/null
+++ b/app/src/main/java/com/example/oplogy/MapsActivity.java
@@ -0,0 +1,56 @@
+package com.example.oplogy;
+
+import androidx.fragment.app.FragmentActivity;
+
+import android.os.Bundle;
+
+import com.google.android.gms.maps.CameraUpdateFactory;
+import com.google.android.gms.maps.GoogleMap;
+import com.google.android.gms.maps.OnMapReadyCallback;
+import com.google.android.gms.maps.SupportMapFragment;
+import com.google.android.gms.maps.model.LatLng;
+import com.google.android.gms.maps.model.MarkerOptions;
+import com.example.oplogy.databinding.ActivityMapsBinding;
+
+public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
+
+ private GoogleMap mMap;
+ private ActivityMapsBinding binding;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ binding = ActivityMapsBinding.inflate(getLayoutInflater());
+ setContentView(binding.getRoot());
+
+ // Obtain the SupportMapFragment and get notified when the map is ready to be used.
+ SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
+ .findFragmentById(R.id.map);
+ mapFragment.getMapAsync(this);
+ }
+
+ /**
+ * Manipulates the map once available.
+ * This callback is triggered when the map is ready to be used.
+ * This is where we can add markers or lines, add listeners or move the camera. In this case,
+ * we just add a marker near Sydney, Australia.
+ * If Google Play services is not installed on the device, the user will be prompted to install
+ * it inside the SupportMapFragment. This method will only be triggered once the user has
+ * installed Google Play services and returned to the app.
+ */
+ @Override
+ public void onMapReady(GoogleMap googleMap) {
+ mMap = googleMap;
+
+ // Add a marker in Sydney and move the camera
+ /// 緯度経度
+ LatLng loc = new LatLng(35.17260398479137, 136.88635173557998);
+ /// マーカーオプションを設定(情報ウィンドウ)
+ mMap.addMarker(new MarkerOptions().position(loc).title("トライデントコンピュータ専門学校"));
+ /// 表示位置を地図に指定
+ mMap.moveCamera(CameraUpdateFactory.newLatLng(loc));
+ /// 地図の倍率を指定
+ mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 17));
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 44003e4..d143b77 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -8,8 +8,8 @@
android:orientation="vertical">