我在寻找的API,提供由用户定义的日期时间信息。我在过去使用联系人列表如下:
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);
和 onActivityResult
用
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));
我可以提取的名称的电话和的Gmail 的。
现在我的目标是与格式YYYY-MM-DD HH做同样的日期,时间:MM:SS。 是这样的:
Now my aim to do the same for Date-time with format YYYY-MM-DD hh:mm:ss. Something like:
我不希望由我自己来实现它,因为此功能存在(仅在情况下,如果没有API)
I don't want to implement it by myself since this feature exists (only in case if no API)
任何想法?
是的,Android已经内置的日期和时间选择器对话框,看到的有关详细信息,这文章(它使用的片段,但你可以用简单的 DatePickerDialog 和放大器; TimePickerDialog )。
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:
的https://$c$c.google.com/p/android -dateslider / 的https://$c$c.google.com/p/android - 车轮/ 的https://$c$c.google .COM / P /滚动选择器视图换安卓/ ... https://code.google.com/p/android-dateslider/ https://code.google.com/p/android-wheel/ https://code.google.com/p/scroll-picker-view-for-android/ ...(采用Android UI模式的应用程序的https: //play.google.com/store/apps/details?id=com.groidify.uipatterns&hl=es 中找到像这些库)
(Use Android UI patterns app https://play.google.com/store/apps/details?id=com.groidify.uipatterns&hl=es to find libraries like these)