I have my answer, I was calling the text value from outside the button onClick, below is the correct code:
// PAGE 1
Button submit = (Button)findViewById(R.id.btnsubmit);
submit.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
EditText value= (EditText) findViewById(R.id.VALUETOPASS);
final String VALUE= value.getText().toString();
Intent i = new Intent(page1.this, page2.class);
i.putExtra("ARRIVING_FROM", VALUE);
i.putExtra("TEST", "test");
startActivity(i);
}
});
// PAGE 2
Intent i = getIntent();
Bundle b = i.getExtras();
String newText = b.getString("ARRIVING_FROM")+" "+ b.getString("TEST");
Thanks All
You should do
VALUE= value.getText().toString();inside the onclick handler. The way this is set up, it will take the text from the textview at the very start (where it is empty) and pass this empty string to the 2nd intent.