这是我的活动登录代码
public void onClick(View v) {
switch (v.getId()){
case R.id.email_sign_in_button:
EditText em = (EditText) findViewById(R.id.email);
EditText pass = (EditText) findViewById(R.id.password);
String password=pass.getText().toString();
String email=em.getText().toString();
String storedPassword =helper.getSinlgeEntry(email,password);
String storedName =helper.getName(email);
if(password.equals(storedPassword))
{
Intent i1 = new Intent(LoginActivity.this, MainActivity.class);
i1.putExtra("1", storedName);
i1.putExtra("2",email);
startActivity(i1);
Toast.makeText(LoginActivity.this, "Congrats: Login Successfull", Toast.LENGTH_LONG).show();
}
else
{
Toast Tpass = Toast.makeText(LoginActivity.this, "Invalide Mot de Passe", Toast.LENGTH_LONG);
Tpass.show();
}
break;
case R.id.creer:
Intent i1 = new Intent(LoginActivity.this, InscriptioNActivity.class);
startActivity(i1);
break;
}
}
代码中的意图将通过两个值电子邮件和名称
发送给MaintActivity我想放在那里,这是导航标题
就像这个例子一样
getIntent().getExtras().getInt("1");
如果代码中缺少的东西我会添加 非常感谢你^^