So this is the code in my fragment but the button doesn’t do anything when I click it.
class CreateJobFragment : Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
private var param2: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
param1 = it.getString(ARG_PARAM1)
param2 = it.getString(ARG_PARAM2)
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
val view: View = inflater!!.inflate(R.layout.fragment_create_job, container, false)
view.create_btn.setOnClickListener {
Log.d("console", "Button pressed")
}
return inflater.inflate(R.layout.fragment_create_job, container, false)
}
companion object {
@JvmStatic
fun newInstance(param1: String, param2: String) =
CreateJobFragment().apply {
arguments = Bundle().apply {
putString(ARG_PARAM1, param1)
putString(ARG_PARAM2, param2)
}
}
}
}