tags:

views:

28

answers:

2

In my code I'm calling a preferences activity from my main activity which prompts the user to enter username/password, as below..


// Launch Preference activity

Intent k = new Intent(application.this, settings.class);

startActivity(k);


This calls settings.xml, but I want to re-initiate the main activity once the username/password is set and the back button is pressed.

Any pointers?

A: 

I don't follow once the back button on the phone is pressed it should return to the activity that started the new one..

Unless you have a custom button in your app you can just use: finish(); in the onclicklistener

Jreeter
+2  A: 

Do you want to reload main so you can use the username and password? If so, why not use startActivityForResult, validate the username/password in Settings.class and read the result in onActivityResult in your main activity?

Al