Will try to keep this as concise as possible...
I would like to have a method in my MainActivty class, say updateUI().
I have another file that is an object called FBManager. That object essentially holds "static" firebase access methods.. let's say signInUser()
From the Activity I call FBManager.signInUser()... It does some logic and moves through 2 private methods and at the last private method, I would like to essentially call MainActivity.updateUI()…</p>
This can't be done as kotlin doesn't have static methods and can't make updateUI() static. MainActivity().updateUI() compiles but is incorrect and don't want to instantiate a new MainActivity. Lastly, I thought of passing the activity into the first constructor like FBManager.signInUser(this)... But after signInUser(), it goes to an override method that can only take a bundle as an optional input (and I don't believe you can put activities into a bundle), thus I can't pass the activity reference to the final private method.....
Edit: Further elaboration
object FBManager {
fun signInUser() {
// Create intent
startActivityForResult(intent)
}
override fun onActivityResult(some intent stuff) {
//Try catch block. In try block call
firebaseAuth(Google account)
}
fun firebaseAuth(acct: GoogleSignInAccount) {
//More logic and an .onCompleteListener
// Inside .onCompeteListener, which is the problem....
MainActivity.updateUI()
}
}
Apologies for layout... Typing on my phone...
-end edit-
I hope all that makes sense as I'm new to programming and find it difficult to explain my problems (since if I truely understood them I could come up with a solution..)
So as per the title, is there any other way to do this... To call a method in MainActivity from an object FBManager?