주소로 검색
좌표로 검색 + zoom 설정
전화걸기
sms 보내기
binding.btnMap.setOnClickListener{
val uri = Uri.parse("geo:36.145014, 128.393047?z=17")
val intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
}
binding.btnTelephone.setOnClickListener {
val uri = Uri.parse("sms:010-1234-5678")
val intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
}
Toast.makeText(this, "눌렸습니다",
Toast.LENGTH_SHORT).show()
//static 메소드를 사용했으므로 show를 반드시 호출 해줘야 함!!
문제가 생긴다? androidManifest 다시 확인해보기
binding.btnExplicitIntent.setOnClickListener {
val intent = Intent(this, ImageActivity::class.java)
startActivity(intent)
}
binding.btnImplicitIntent.setOnClickListener {
val uri = Uri.parse("https://www.youtube.com/results?search_query=" + binding.editText.text)
val intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
}
//activity_main.xml
<Button
android:id="@+id/btn_explicit_intent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="이미지"
app:layout_constraintBottom_toTopOf="@id/edit_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/btn_implicit_intent"
app:layout_constraintTop_toBottomOf="@id/btn_explicit_intent"
/>
<Button
android:id="@+id/btn_implicit_intent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="유튜브"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/edit_text"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_explicit_intent" />