Face if you are saving the user in a table.
when you start the app grab your user from the table, and put them in the Application.
So from any screen you can access your user.
Follow the example
in the manifest
<application
android:name="pacote.MyApplication"
Application class
public class MyApplication extends Application {
private User user;
...gets sets
its main Actv
public class MainActivity extends Activity {
private MyApplication application;
private User user;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
application = (MyApplication) this.getApplicationContext();
user = //pego o user em seu db sqlite
application.setUser(user); // set o user no seu application
//agora pode usar o objeto que e esta no Apllication
// Ex: application.getUser().getNome;
using in another Actv
public class OutraActivity extends Activity {
private MyApplication application;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_outra_tela);
application = (MyApplication) this.getApplicationContext();
//use o objeto do Application
application.getUser().getNome;
hope to have helped in your knowledge...and in your app...
Valew
where are you storing these users? on mobile or cloud?
– dariodm
on the same phone, I made a table and put it there, very simple. @dariodm
– Allan Chrystian
certro lets answer!
– dariodm
let who answer? @dariodm
– Allan Chrystian