Skip to content

Tag: fragment

Call method in Fragment from some class

I’ve been working on Android App in AndroidStudio. Application has Fragment, let’s call it MainFragment, and seperate Java Class file, let’s call it SQLiteControler.class The problem is when i try to call method from Fragment in SQLiteController im getting null object reference as error Here…

SetText in fragment from outside class

I have a fragment that displays data from APIs, but i dont want to be calling apis everytime the fragment is called.. so am making api call from a different class and and calling a method in the fragment to update UI (textViews) but am getting null exception for the textViews but data is 100% there and if i t…

Using kotlin extension function in Java code

I have created an extension function for listening to click listener for buttons, when I try to access it from Java code it does not work, Cannot access clicks() from java file, this is what I tried Can you please suggest how to resolve this. Thanks R File – Extension.kt In my java code – FillingF…

supportFragmentManager.commit in kotlin is not working

Can anyone help me with this please? Inside my fragment supportFragmentManager.commit{} is not working. Android Studio is not recognizing this I don’t know what to do. I am working in kotlin project Answer That commit {} method (with the transaction in a lambda) is an extension function provided by the …