How to pass the date and time from one layout to another [closed]
First layout has a button to pick date,another button to pick time. After picking date & time from popups, a next button is clicked. On this click , the second layout that contains date and time picker. In this we have to set the previously fetched date and time...
you can pick the date and store into the string same way store the time now if you press next button and open the another activity you can pass this date and time value using Intent object by put().
Intent intent = new Intent(this,YourClass.class);
intent.put("Date",date);
intent.put("Time",time);
startActivity(intent);
and in another activity you can get this way
String date = getIntent().getExtra().getString("Date");
String time = getIntent().getExtra().getString("Time");
if you want to set the date and time value in same activity then no need you can use this date and time object in your activity class and declare as
private String date,time;
so you can you only within this acitivity.
精彩评论