I have a button When the user clicks on it, it will be redirects to a registration page I want user to be redirect to a loading page after clicking on the signup button And then i want the user to be returns to the main page And I want a message with the title of "your registration successfully completed" to be display to the user And after a few seconds, this alert message to be hide
-
Add Code to solve issue – Ashish Dec 26 '18 at 11:40
3 Answers
Follow this way to activity switch
Intent intent = new Intent(RegistrationActivity.this, DashBaord.class);
startActivity(intent);
finish();

- 2,521
- 1
- 19
- 33
-
i mean a sign up button from a website not from the app when user clicks on a button will be redirect to a webpage with a registraion form when user clicks on sign up button i want user to returns to home screen but in my app the user should press the back button to returns to home screen – Coal Carter Dec 26 '18 at 14:20
Suppose your registration activity is RegistrationActivity where you will showing your sign up button and HomeActivity will be the activity which will be shown to user after registering to the app successfully.
You have to maintain some variable so you can know if that variable is registered or not.
boolean isUserRegistered ;
if a user is registered successfully then,
isUserRegistered = true;
and save this varibale using SharedPreferences.For more info about SharedPreferences : Android Shared preferences example
In the splash activity or some other activity where you will decide which activity to open put this check,
if(isUserRegistered)
//start HomeActvity
else
//start RegistrationActivity

- 1,471
- 4
- 17
- 37
-
i mean a sign up button from a website not from the app when user clicks on a button will be redirect to a webpage with a registraion form when user clicks on sign up button i want user to returns to home screen but in my app the user should press the back button to returns to home screen – Coal Carter Dec 26 '18 at 14:20
I think your requirement is to create a signup Activity and on completing signup, the user needs to be redirected to Homepage and display a dialog with content "your registration successfully completed".
First of all you need to create a signup Activity. Then when clicking signup, display a custom dialogfragment indicating Loading. Show this dialog when user clicks the signup button. Then make an api request to complete the signup. On response of this api request, dismiss the custom dialogfragment and go to Home activity.
Creating a dialog Fragment : link
On going to Home activity, you need to pass the response of the API request along with intent. In the Home Activity, you can get the value passed along with the intent to HomeScreen to get the message you want to display. You can use an Alert Dialog or custom DialogFragment for displaying the info.
To dismiss the dialog after x seconds, you can use postDelayed(Runnable, long). Creating a Post Delayed : link

- 177
- 1
- 14
-
i mean a sign up button from a website not from the app when user clicks on a button will be redirect to a webpage with a registraion form when user clicks on sign up button i want user to returns to home screen but in my app the user should press the back button to returns to home screen – Coal Carter Dec 26 '18 at 14:14