我需要将特定ID发送到另一个活动,“i.putExtra”会发送用户名,但有没有办法发送该用户的ID?
public void onButtonClick(View v)
{
if(v.getId() == R.id.Blogin)
{
EditText a = (EditText)findViewById(R.id.TFusername);
String str = a.getText().toString();
EditText b = (EditText)findViewById(R.id.TFpassword);
String pass = b.getText().toString();
String password = helper.searchPass(str);
if(pass.equals(password))
{
Intent i = new Intent(MainActivity.this, Category.class);
i.putExtra("Username",str);
startActivity(i);
}
else
{
Toast warn = Toast.makeText(MainActivity.this , "Username or password wrong!" , Toast.LENGTH_SHORT);
warn.show();
} }