2013-04-16 2 views
0

내 응용 프로그램에 약간의 문제가 있습니다. 삼성 갤럭시 폰 "fileNameMap.getContentTypeFor (path)"에서이 줄을 실행할 때 null 값을 얻었습니다. 나는 NEXUS, LG 옵티머스 등 다양한 휴대 전화에서 동일한 코드를 시도했지만이 문장은, video.avi 등이 ... 이 PLZ 도움이되지 널 (null) 그러나 어떤 파일 형식 즉, 비디오/MP4, 비디오/3GP 돌아삼성 Galaxy fileNameMap.getContentTypeFor (path) NULL을 반환합니다.

//----Code 

public static String getMimeType(){ 

     String path="__MACOSX/._MR_BEAN_FUNNY.3gp"; 

     FileNameMap fileNameMap = URLConnection.getFileNameMap(); 
     if (path.startsWith("/")) 
     { 

      path = "file:/"+ path; 
     } 
     else 
     { 

      path = "file://" + path; 
     } 

     String type = fileNameMap.getContentTypeFor(path); 


     return type;   
    } 
+0

아무도 이것에 대해 잘 모릅니다. 이전에 아무도이 문제가 없었습니까? – Nik

답변

0

이 문제가 해결되었습니다 ....

String type; 

     String extension = MimeTypeMap.getFileExtensionFromUrl(path); 
     type=MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); 

return type; 
관련 문제