0
I needed to create a static method in the main Activity, because Firebase is not accepting Framents
within the CreateUserWithEmailAndPassword
.
I would like to know how I refer to the main Activity within the mode Static
.
This code is inside the activity_cadastro
, because inside the Fragment
, Firebase is not accepting.
So I’m collecting the data in the Fragment (fragment_usuario
), I place this data (email, password, etc) inside an object User and pass this object User by parameter to the activity_cadastro
.
How the method is Static
, the This is not being referenced.
That method must be Static? By making it Static another problem has been created. Normally, a solution that creates another problem is not the best approach. Cannot use this "directly" can pass it to the method. I do not know if it will be possible and does not guarantee that other problems arise.
– ramaral
Do you really need an Activity? Is it not a Context that is needed? See How to obtain the context in a Fragment? and What difference between methods to obtain a context?
– ramaral
To answer the questions: @Ramaral Yes... It had to be
Static
because I wasn’t able to solve the question ofContext
so I was using a method I created in another Activity. It seems that your second comment solved my problem. I managed to add the user. Toast is not showing the result of the errors, but this I see on another occasion. Thank you.– rioleal
@Ramaral, unfortunately I can’t or I don’t know how to mark your comment as an answer. But thank you.
– rioleal