Search code examples
androidandroid-studiokotlinparameter-passingandroid-safe-args

Passing args in kotlin using safe args plugin


I want to pass args by safe args in kotlin (android studio). No matter what I try I am always getting this error in onCreateView. Require arguments are in red. On alt+enter it wants to create new function but that is not what I need. Does anyone know what could be problem and how to fix it.

Edit: Imprts

Imports 1

dependencies in gradle


Solution

  • import androidx.navigation.fragment.navArgs
    

    Try with declaring an instance variable like private val args: KrajFragmentArgs by navArgs() And then get data from args variable.