![]() If anybody could tell me where I’m wrong I’d be really grateful! Thanks in advance! I could supply the fragment and layout files if needed – just thought this way it might be easier at first. Even ran into NullPointerExceptions on my way to a solution. ![]() Toast.makeText(ntext, "New exercise will be generated", Toast.LENGTH_SHORT).show()īut nothing happens when I start the app/ hit the buttons – I seem to can’t get through to the actual view’s objects to access them. I also tried onClickListening for buttons like so: val btnNewExercise = view.findViewById(R.id.btn_new_exercise) The last line stands for every object I tried to reach. ![]() ("This is an exceptionally hardcoded string") Val view: View = inflater!!.inflate(R.agment_home,container,false) _binding = FragmentHomeBinding.inflate(inflater, container, false) ![]() ViewModelProvider(this).get(HomeViewModel::class.java) I checked every source of advice I could find from Google & Stackoverflow and came up with the following code in HomeFragment.kt (partially pre-coded by AndroidStudio): override fun onCreateView( Given there’s a the editText object exercise in fragment_home.xml and I want to call and alter it in HomeFragment.kt. Now, to break my current issue down to a simple example that even doesn’t work for me: It features three fragments that can be navigated through by a bottom navigation bar. ![]() I’ve recently picked up an Android Studio project I started a year ago in Kotlin. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |