Relative Content

Tag Archive for androidkotlinandroid-jetpack-compose

Place checkboxes in positions relative to image Jetpack Compose

I am learning Kotlin for the first time and developing an app using Jetpack Compose to log bones on an archaeological site. This app will be used on different devices with different screen sizes. The bones are logged by opening an image of a bone and clicking on checkboxes on the image to mark particular fragments of the bone that have been found. To do this, the checkboxes have to be placed exactly where the fragment is on the bone. Unfortunately, the positions of the checkboxes change whenever I test with a different device size on the emulator. How can I place the checkboxes relative to the image so they appear in the exact same coordinates on the image, no matter what the size of the screen/image is?

How to pass additional data to the ViewModel from a Jetpack Compose screen?

I’m navigating to a destination that initially displays a DatePickerModal, and a set of buttons on the screen. When the user selects a date and clicks on one of the buttons, I want to pass the selected date and the button that was pressed to the ViewModel, so that based on that data, actions can be executed in the data repository.

How to pass additional data to the ViewModel from a Jetpack Compose screen?

I’m navigating to a destination that initially displays a DatePickerModal, and a set of buttons on the screen. When the user selects a date and clicks on one of the buttons, I want to pass the selected date and the button that was pressed to the ViewModel, so that based on that data, actions can be executed in the data repository.