/
Kulechek
/
Lab_9
Обзор
Документация
Войти
/
Kulechek
/
Lab_9
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
app/src/main/java/com/example/lab_9/PhoneActivity.java
28 строк
1 KB
Temnikov Konstantin
.
25 апр 2025, 14:37
25 апр 2025, 14:37
ca2a451
Код
Авторство
О чём код?
package com.example.lab_9; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; public class PhoneActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_phone); String phone_1 = getString(R.string.phone_1); String phone_2 = getString(R.string.phone_2); String phone_3 = getString(R.string.phone_3); findViewById(R.id.buttonNumber1).setOnClickListener(v -> startPhoneCallIntent(phone_1)); findViewById(R.id.buttonNumber2).setOnClickListener(v -> startPhoneCallIntent(phone_2)); findViewById(R.id.buttonNumber3).setOnClickListener(v -> startPhoneCallIntent(phone_3)); } private void startPhoneCallIntent(String phoneNumber) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber)); startActivity(intent); } }