I'm working on an app where I type date in the EditText and it will send the date(which is typed in) to another activity and display as a TextView. I had created a button above the text box.
Below are the 2 activities of sending and getting the date. PersonalInfo.class these are the codes for sending the date to another activity
Button btnDate = (Button) findViewById(R.id.btnDate);
btnDate.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent dateIntent = new Intent();
dateIntent.setClass(PersonalInfo.this, Create_Events.class);
dateIntent.putExtra("passDate", "Date_var_here");
PersonalInfo.this.startActivity(dateIntent);
}
});
Create_Events.class Codes for getting the date from first activity, and it'll display the date as textview
Intent dateIntent = this.getIntent();
/* Obtain String from Intent */
if(dateIntent !=null)
{
String strDate = dateIntent.getExtras().getString("passDate");
TextView txtDate = (TextView) findViewById(R.id.txtDate);
txtDate.setText(strDate);
}