I have a "Login" xml in layout. And I have another xml is the "List".
In my Application, the user login into the application with e-mail address and password than show their mail list. I did it like that:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
LoginScreen();
}
// I am receiving the email and password on the main layout for login page
public void LoginScreen()
{
setContentView(R.layout.main);
EditText emailTxt = (EditText) findViewById(R.id.txtMail);
EditText passwordTxt = (EditText) findViewById(R.id.txtPassword);
String email= epostaTxt.getText().toString();
String password = parolaTxt.getText().toString();
// After receive, call the MailList() for connection and getting the list
MailList()
}
// and I use this email and password again into the MailList() for connection with server then receive the mail list
public void MailList()
{
setContentView(R.layout.list);
EditText emailTxt = (EditText) findViewById(R.id.txtMail);
EditText passwordTxt = (EditText) findViewById(R.id.txtPassword);
String email= epostaTxt.getText().toString();
String password = parolaTxt.getText().toString();
Sending emain and password to the server etc...
}
This just for now but this code repeat will be continue . I want to get this email and password from Edittxt just one time and use it all the methods. And this code doesn't work also, Maillist doesn't show the list because cannot connect
How can I do that?