我试图开发一个Android应用程序。在这里我必须开发忘记密码option.i必须单击忘记密码textview意味着它是去下一个activity.next活动有输入用户名。我必须从mysql数据库检查用户名是有效还是无效。用户名有效意味着它是下一个活动。下一个活动有输入一些文本(密码)字段。我必须点击更新按钮意味着该用户的密码被更新。将数据从一个活动传递到Android应用程序中的下一个活动
在这里,我已经完成了用户名是有效的和无效activity.but我怎么可以传递用户名数据到下一个活动和更新这些特定用户的密码。
在这里,我必须更新密码(第二次活动)从用户名(基于第一次活动)。如何开发these.please帮助我。
这是我的第一个活动:
PropertyInfo unameProp =new PropertyInfo();
unameProp.setName("Username");//Define the variable name in the web service method
unameProp.setValue(login);//set value for userName variable
unameProp.setType(String.class);//Define the type of the variable
request.addProperty(unameProp);
----
-----
if(status.equals("Valid Username"))
{
Intent intent = new Intent(Login.this,RetailerActivity.class);
intent.putExtra("Username", login);
startActivity(intent);
}
下一个活动代码是象下面这样:
btninsert = (Button)findViewById(R.id.btn_insert1);
btninsert.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent in = getIntent();
EditText userPassword = (EditText) findViewById(R.id.edittext);
String user_Name = userPassword.getText().toString();
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo unameProp =new PropertyInfo();
unameProp.setName("userPassword");//Define the variable name in the web service method
unameProp.setValue(user_Name);//Define value for fname variable
unameProp.setType(String.class);//Define the type of the variable
request.addProperty(unameProp);
PropertyInfo idProp =new PropertyInfo();
idProp.setName("Username");//Define the variable name in the web service method
idProp.setValue();//Define value for fname variable
idProp.setType(String.class);//Define the type of the variable
request.addProperty(idProp);
如何从1日的活动传递的用户名值下一个活动。
在firstactivity我有传递数据。所以我已经使用下面的代码:intent.putExtra(“用户名”,登录);这是正确的only.now我怎么能得到第二活动的数据 – user1897014
看到我编辑的答案... –
嗨,这是完整的我的源代码:第一活动:http://pastie.org/5514961第二活动代码:http: //pastie.org/5514963请检查我的代码,并给我solution.i已更新我的代码从您的上述solution.i没有更新我的密码 – user1897014