Advertisement
sivak12

Untitled

Feb 26th, 2025 (edited)
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 0.85 KB | None | 0 0
  1. <TextView
  2.    android:layout_width="wrap_content"
  3.    android:layout_height="wrap_content"
  4.    android:text="Интервал уведомлений (минуты):"
  5.    android:layout_marginTop="16dp"/>
  6.  
  7. <EditText
  8.    android:id="@+id/editNotificationInterval"
  9.    android:layout_width="match_parent"
  10.    android:layout_height="wrap_content"
  11.    android:inputType="number"
  12.    android:hint="Например, 60"/>
  13.  
  14.  
  15. val editNotificationInterval = findViewById<EditText>(R.id.editNotificationInterval)
  16.  
  17. // Загружаем сохранённый интервал
  18. editNotificationInterval.setText(sharedPreferences.getInt("notificationInterval", 60).toString())
  19.  
  20. val notificationInterval = editNotificationInterval.text.toString().toIntOrNull() ?: 60
  21. sharedPreferences.edit()
  22.     .putInt("notificationInterval", notificationInterval)
  23.     .apply()
  24.  
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement