Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainActivity : Activity
- {
- DatePicker mDatePicker;
- protected override void OnCreate(Bundle bundle)
- {
- base.OnCreate(bundle);
- // Set our view from the "main" layout resource
- SetContentView (Resource.Layout.Main);
- mDatePicker = FindViewById<DatePicker>(Resource.Id.mDatePicker);
- }
- public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent e)
- {
- //when user press c, the date of the DatePicker will be updated
- if (keyCode == Keycode.C)
- {
- mDatePicker.UpdateDate(mDatePicker.Year, mDatePicker.Month, mDatePicker.DayOfMonth + 1);
- }
- return true;
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <DatePicker
- android:id="@+id/mDatePicker"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
- </LinearLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement