Android 只选择今天创建的图片

洛阳Young
  • 62
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, REQUEST_IMAGE);

有没有可能在上面的代码里做文章来实现这个功能

还是说只能自定义了?

回复
阅读 1k
1 个回答
 Date today = new Date();
      today.setHours(0);
      today.setMinutes(0);
      today.setSeconds(0);

 final long time = today.getTime()/1000;
        
 Cursor cursor = MediaStore.Images.Media.query(getContentResolver(),
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI
                , null
                , MediaStore.Images.Media.DATE_MODIFIED + ">"+ time
                , null
                , MediaStore.Images.Media.DATE_MODIFIED+" DESC");
宣传栏