ommaviymantiqiy onCreateOptionsMenu (Menyu menyusi) {
// Menyuni to'ldirish; agar mavjud bo'lsa, bu harakatlar paneliga elementlar qo'shadi.
getMenuInflater().inflate(R.menu.main, menyu);
rostniqaytarish ;
}
}
Chiqish:
Dastur ishlashi jarayonida elementlarni o‘chirish va yaratish.
Quyidagi kod misoli qadam ma'lumotlarini UID orqali qanday o'chirishni ko'rsatadi. Record noyob identifikatorini metadata.uid saytida topish mumkin.
suspend fun deleteStepsByUniqueIdentifier( healthConnectClient: HealthConnectClient, uid1: String,
uid2: String
) {
healthConnectClient.deleteRecords( StepsRecord::class,
uidsList = listOf(uid1, uid2), clientRecordIdsList = emptyList()
)
}
Quyidagi kod misoli vaqt oralig'ida ma'lum bir turdagi ma'lumotlarni qanday o'chirishni ko'rsatadi.
suspend fun deleteStepsByTimeRange( healthConnectClient: HealthConnectClient, startTime: Instant,
endTime: Instant
) {
healthConnectClient.deleteRecords( StepsRecord::class, timeRangeFilter =
TimeRangeFilter.between(startTime, endTime)
)
}