Skip to content
Advertisement

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 is some minified code: MainFragment SQLiteController Note: This is minified code I have tried, a

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 try

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 – FillingFragment.java DataViewHolder.Java Answer Extension functions

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 Fragment KTX library. If you haven’t already, you need to

Cannot find symbol error in android studio

I’m trying to add fragments to a navigation drawer. But I have the error: cannot find symbol class Fragment. I added: import android.support.v4.app.Fragment Also add the fragment object(Fragment fragment) Where is the mistake? What should I do? Home.java build.grandle I’ve tried to search the web and forums but so far I didn’t find anything helpful. Thank You so much. Answer

Advertisement