Reputation: 605
Requirement is pretty simple. First time user is asked to SignUp with a signUp screen activity. Once signed Up, he/she will be logged in to the application and second Activity is presented to user. Once user exit and re-launch the application I have to directly take the user to the second activity(without showing the 1st activity). I have tried conditional launching the activity, but the transition is not smooth.
Can you anyone suggest me a better way of having multiple entry point application?
Thanks
Upvotes: 2
Views: 1433
Reputation: 630
My suggestion is using a splash screen on the beginning, and use it to make a conditional choose between login activity
or after-login activity
. With this implementation you don't have problems with smooth transitions.
UPDATE:
Based on your idea i implemented an operation to verify if user is logged in.
In my loginActivity i implement my onStart()
with a verification based on my sessionManager
. There i have methods like isLoggedIn()
to check if the user data is still on cache, and getLoginType()
for different kind of logins (admin, guest, ...)
If this stuff is verified:
startactivity(new Intent(loginactivity.this, otheractivity.class))
Upvotes: 0
Reputation: 21
In the past, I've always used the approach that you've described without any bumps or hickups in the transition.
Perhaps it's a matter of execution. I generally put my conditional (has the user already signed up), in the onCreate() method of the authentication activity. In the case that they have signed up, I will start the new activity and finish() the previous activity.
If for some reason this doesn't work, another approach which might require restructuring your code a little is the use for Fragments.
If you make the main activity use fragments instead, you can simply have a check in onCreate which will determine which Fragment will be displayed when the user launches the app, and you can just bounce fragments in and out from there out.
Upvotes: 2