Initiating activity for settings class
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 Inte开发者_StackOverflownt(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?
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?
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
精彩评论