I'm looking for API that provide Date-time info defined by user. I used in the past Contact List like:
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
((Activity) mContext).startActivityForResult(intent, LauncherUI.RESULT_GOT_CONTACT_INFO);
and on onActivityResult
by using
Uri contactData = intent.getData();
//Cursor cursor = managedQuery(contactData, null, null, null, null);
Cursor cursor = cr.query(contactData, null, null, null, null);
cursor.moveToFirst();
String name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
String id = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts._ID));
I could extract name, phone and gmail.
Now my aim to do the same for Date-time with format YYYY-MM-DD hh:mm:ss. Something like:
I don't want to implement it by myself since this feature exists (only in case if no API)
Any ideas?
Yes, Android has built-in date and time picker dialogs, see this article for details (it uses fragments but you can use simply DatePickerDialog & TimePickerDialog).
You can also use other open source libraries with a cool data picker:
(Use Android UI patterns app https://play.google.com/store/apps/details?id=com.groidify.uipatterns&hl=es to find libraries like these)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With