Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
yilzer
4,601 PointsSend data to php server like username, password, but first i want tot save it in android before i make the request!
Hi guys, i have a question about saving information like username and password in android, so that i can register date of birth and phonenumber later. I want to make a request to the php server with al information in that request. Do you guys know how you can save information like username and password before i go to another activity to save birth an phonenumber and make the final request to sign up? I know that in php the term of saving this information is Session.
Thanks in Advance!
2 Answers
Leonardo Vidal
14,603 PointsHello , you can put the username and password as an extra in the intent that start the new activity
Intent intent = new Intent(this, NewActivity.class);
intent.putExtra("user","username");
intent.putExtra("pass","1234");
startActivity(intent);
Then you can retrieve both values in the OnCreate() of the NewActivity
String user= getIntent().getStringExtra("user");
String password = getIntent().getStringExtra("pass");
yilzer
4,601 PointsThank you very much!