[SOLVED] Fragment inflate not intended xml file

Issue I have a problem that EditSleepPressureFactorFragment inflates other xml file fragment_sleep_record.xml. But my intention is to inflate fragment_edit_sleep_pressure.xml. A Spinner having an id "year_spinner" is in fragment_edit_sleep_pressure.xml but binding!!.yearSpinner code occure unsolved refference. And binding!!.startSleepYear code cause no error.

Continue reading

[SOLVED] ViewBinding in Fragment

Issue I want to use ViewBinding to work with Views in Fragment. FragmentBlankBinding binding; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { binding = FragmentBlankBinding.inflate(inflater, container, false); return binding.getRoot(); } But when I try to get RecyclerView from

Continue reading

[SOLVED] Android Kotlin Fragments: ''Attempt to invoke virtual method on a null object reference''

Issue My code in MainActivity: val buttonbckbrowse = findViewById<Button>(R.id.buttonbck) buttonbckbrowse.setOnClickListener { val webView = findViewById<WebView>(R.id.webViewBrowse) webView.goBack() Toast.makeText(baseContext, "Back", Toast.LENGTH_SHORT).show() } buttonbck is in a different fragment. When trying to run my app I get ”Exception: Attempt to invoke virtual method

Continue reading