开发者

How to pass the date and time from one layout to another [closed]

开发者 https://www.devze.com 2023-04-02 19:36 出处:网络
It's difficul开发者_StackOverflow社区t to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its curr
It's difficul开发者_StackOverflow社区t to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消