안드로이드 하위 버전에서는 잘 동작하는걸로 알고 있었는데....

 

제가 갤럭시노트2로 바꾸면서 보니까,,, setLastModified 결과가 false로 나오네요...

 

혹시 권한이 바뀐건지??

 

어떤 분은 해킹 보안 때문에 바뀌었다고 하는데,,,, 정확한 답을 모르겠습니다..

 

파일수정일자를 기준으로 파일을 정렬해야 하는데,,,,

 

꼭 다른방법을 사용하여 해야하는지,,,,, 방법이 없을까요??

 

코드 구조는

URL에서 사진 파일을 받아와서 파일을 생성한후에 FileOutputStream를 이용하여  byte를 Write를 한후 스트림을 닫고 날짜를 수정합니다.

 

// System.currentTimeMillis()를 사용하여도 결과는 똑같습니다.

 

//need convert the above date to milliseconds in long value 
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
String newLastModified = "01/31/1998";


    Date newDate = null;
    try
    {
     newDate = sdf.parse(newLastModified);
    }
    catch (ParseException e)
    {
     // TODO Auto-generated catch block
     e.printStackTrace();
    }
    
          boolean x = file.setLastModified(newDate.getTime());        
          if(x)
          {
           Log.d("test" , "성공");
          }
          else
          {
           Log.d("test" , "실패");
          }