Home  >  Q&A  >  body text

android如何实现相册时光轴?

现在要实现扫描手机拍摄的所有照片,然后按照时间进行排序,实现时光轴效果,请问如何实现?

ringa_leeringa_lee2715 days ago641

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 16:25:53

    1. Simply sort by the modification time of the photo files, file.lastModified()get the last modification time of the file, and then compare;
    2. Accurately obtain the time, the photos have EXIF ​​information, which includes the photo shooting time, location coordinates, aperture, Equipment, etc., time acquisition example

    ExifInterface exif = new ExifInterface(path);
    String date = exif.getAttribute(ExifInterface.TAG_DATETIME);
    

    For more information, just pass different TAGs. Please refer to the ExifInterface TAG definition for details.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 16:25:53

    Some photos do not have exif information, and reading from exif is not complete enough
    Read the last modification time of the file directly from the database

    reply
    0
  • Cancelreply