0

I’m new in android programming I’m working on database application I would like to know how can I make application open activity depend on condition result The application will check for the database. if the database is created or not If yes, open login activity If no, open create user profile activity

Best Salim

wandarkaf
  • 1,839
  • 20
  • 30
Salim
  • 41
  • 8

2 Answers2

2

You can make an initial activity with no UI that checks some condition and launches another activity immediately depending on the condition.

See this answer on how to do this:

https://stackoverflow.com/a/4856629/1369222

Community
  • 1
  • 1
Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84
0
if(databasePresent()){
    Intent intent = new Intent(MainActivity.this, LoginActivity.class);
    startActivity(intent);
}else{
    Intent intent = new Intent(MainActivity.this, CreateProfileActivity.class);
    startActivity(intent);
}
Vasudev
  • 1,936
  • 19
  • 17