public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.register_user_details);
btnNext = (Button) findViewById(R.id.btn_next);
btnNext.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0){
Intent nxtpage = new Intent(getApplicationContext(),ChangePassword.class);
edtName= (EditText) findViewById(R.id.edt_name);
edtPhoneNumber= (EditText) findViewById(R.id.edt_phone_number);
String Name=(String)edtName.getText().toString();
String PhoneNumber=(String)edtPhoneNumber.getText().toString();
//Create the bundle
Bundle bundle = new Bundle();
//Add your data to bundle
bundle.putString(“Name”,Name);
bundle.putString(“PhoneNumber”,PhoneNumber);
//Add the bundle to the intent
nxtpage.putExtras(bundle);
//Fire that second activity
startActivity(nxtpage);
}
}
}
}
我试图捆绑此活动[register_user]的值,如姓名和电话号码,并发送到其他活动[注册],但此处显示错误
bundle.putString(“Name”,Name);
bundle.putString(“PhoneNumber”,PhoneNumber);
错误:令牌上的语法错误,而是预期的ArgumentList
任何人都可以告诉我这是什么问题吗?
答案 0 :(得分:0)
更改此
bundle.putString(“Name”,Name);
到
bundle.putString("Name",Name);
类似地
bundle.putString("PhoneNumber",PhoneNumber);
您需要""
而不是“”
答案 1 :(得分:0)
这里是字符串名称和字符串PhoneNumber
之间发生名称冲突请尝试
bundle.putString("name",Name);
bundle.putString("phonenumber",PhoneNumber);