Good evening, I'm having trouble understanding an example
I will try to explain without posting the entire source I think it will be easier to understand
I have a class called GLOBAL that extends Application
I have 3 methods inside it
(...)
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
public boolean isAutenticado(){
return getUsuario() != null;
}
(...)
I have a template class named
import java.io.Serializable;
public class Usuario implements Serializable {
private static final long serialVersionUID = 1L;
private String nome;
public Usuario() {
super();
}
public Usuario(String nome) {
super();
this.nome = nome;
}
public String getNome() {
return nome == null ? "" : nome;
}
public void setNome(String nome) {
this.nome = nome;
}
}
Inside my main activety, there is something very sinister
Well, I'll tell you that I did the configuration on Manifest
(...)
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
iniciar();
app = (MRCDroidAplicacao) getApplication();
}
(...)
That's where zica comes from, in the example of the teacher it works, in this mine I'm posting does not work
Usuario usuario = new Usuario();
usuario.setNome("USUARIO TESTE 1");
app.setUsuario(usuario);
Log.i("TESTE", "Usuario: " + app.getUsuario());
(...)
I do not understand what I'm doing so it's difficult UHEUHEUHE, I'm copying it