一直试图解决这个问题但无法解决。这是 udacity 课程,我尝试使用挂起意图创建通知,但挂起意图可变存在问题,我尝试用这种方式
视图模型
private val REQUEST_CODE = 0
private val TRIGGER_TIME = "TRIGGER_AT"
private val minute: Long = 60_000L
private val second: Long = 1_000L
private val timerLengthOptions: IntArray
private val notifyPendingIntent: PendingIntent
private val alarmManager = app.getSystemService(Context.ALARM_SERVICE) as AlarmManager
private var prefs =
app.getSharedPreferences("com.shivaConsulting.androidProjects.kotlinnotificatons", Context.MODE_PRIVATE)
private val notifyIntent = Intent(app, AlarmReciever::class.java)
private val _timeSelection = MutableLiveData<Int>()
val timeSelection: LiveData<Int>
get() = _timeSelection
private val _elapsedTime = MutableLiveData<Long>()
val elapsedTime: LiveData<Long>
get() = _elapsedTime
private var _alarmOn = MutableLiveData<Boolean>() …Run Code Online (Sandbox Code Playgroud) 我在尝试着:
trailingIcon项可见。TextFieldtrailingIcon其中的文本,并且应该消失。TextFieldtrailingIcontrailingIcon应该出现 并启用此文本清除功能。等等...
我尝试寻找这个问题的解决方案,但大多数都关注“可见trailingIcons”,而不是我想要实现的。
要请求用户设备的最后已知位置,我们可以使用融合位置提供程序来检索设备的最后已知位置getLastLocation(),但使用getCurrentLocation()可以更新且更准确的位置。
fusedLocationClient.getCurrentLocation()那么,由于文档中没有说明示例,如何在 Kotlin 中使用?