I want to keep the value which is entered in the Edit text by the users. then I want to use that entered value in a different class.basically i want the user to enter their username in this class
public class Loginpage extends Activity implements OnClickListener{
EditText usern,passw,dis;
Button ulogin;
String k;
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.loginpage);
usern=(EditText) findViewById(R.id.usern);
passw=(EditText) findViewById(R.id.passw);
dis=(EditText) findViewById(R.id.dis);
ulogin=(Button) findViewById(R.id.ulogin);
ulogin.setOnClickListener(this);
k=usern.getText().toString();
}
@Override
public void onClick(View p) {
// TODO Auto-generated method stub
switch(p.getId()){
case R.id.ulogin:
k=usern.getText().toString();
String passwd=passw.getText().toString();
Process cat = new Process(this);
cat.open();
String returnpass = cat.getpass(k);
cat.close();
if(passwd.equals(returnpass))
{
Intent i=new Intent("com.example.billpay.USEROPTION");
startActivity(i);
Dialog r=new Dialog(this);
r.setTitle("Login Successfull");
TextView wg= new TextView(this);
wg.setText("Success");
r.setContentView(wg);
r.show();
}
else
{
Dialog r=new Dialog(this);
r.setTitle("Wrong Username or Password");
TextView po= new TextView(this);
po.setText("Failure");
r.setContentView(po);
r.show();
}
}
}
}
then i want to use their value which they have entered in the edit text in another class which is this.I want to display their username in this page.
public class Userprofile extends Loginpage {
TextView pra;
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.userprofile);
pra=(TextView)findViewById(R.id.pra);
EditText p=usern;
String op=p.getText().toString();
pra.setText(k);
}
}
but i am not being able to display their value