how to send data from one activity to another in android
how to pass data from one fragment to another fragment in android
how to pass data using intent in android
how to pass data from activity to fragment in android
here we are using MS SQL database
from signinActivity:-
String sql = "SELECT * FROM registration WHERE EmailId = '" + Email.getText() + "' AND pwd = '" + Password.getText() + "' ";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()) {
name =rs.getString("Name");
emailid =rs.getString("EmailId");
mobileNumber= rs.getString("Mobno");
passwrd=rs.getString("pwd");
Log.d("chekname",name);
Log.d("chekemail",emailid);
Log.d("chekmobile",mobileNumber);
Log.d("chekp",passwrd);
Intent intent = new Intent(SignInActivity.this, detailActivity.class);
Bundle bundle = new Bundle();
bundle.putString("named",name);
bundle.putString("Emaild",emailid);
bundle.putString("mobileNumberd",mobileNumber);
bundle.putString("pwdd",passwrd);
intent.putExtras(bundle);
// intent.putExtra("user",name);
startActivity(intent);
To dashboard Activity:
name, email,mobile,password are variable in dashboard activity
named,Emaild,mobileNumberd,pwdd are string as a key sent via intent from sign in activity you can see click here
Paste below code in onCreate method
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
String value = bundle.getString("named");
String named = bundle.getString("named","name");
String Emaild = bundle.getString("Emaild","email");
String mobileNumberd = bundle.getString("mobileNumberd","mobile");
String pwdd = bundle.getString("pwdd","password");
name.setText(named);
email.setText(Emaild);
mobile.setText(mobileNumberd);
password.setText(pwdd);
}
Read more