2014-06-14 1 views
1

sdcard에서 이미지 파일을 삭제하려고합니다. 다음 코드는 에뮬레이터와 잘 작동하지만 Nexus 휴대 전화에서 테스트 할 때 폴더에 검은 색 프레임이 각 삭제 된 이미지에 대해 존재합니다. 유사한 문제와 관련된 게시물은 아래 코드와 같습니다. 방금 ​​안드로이드 프로그래밍을 배우기 시작했고이 시점에서 붙어 있습니다. 정말 감사드립니다.android 삭제 후 SD 카드 폴더에서 삭제 된 이미지의 검은 색 프레임을 제거하는 방법은 무엇입니까?

`

String sdcard_path=Environment.getExternalStorageDirectory().getAbsolutePath()+"/Expense_image"; 
    File cacheFile =new File (sdcard_path,imageLocation); 
    if(cacheFile.exists()){ 

               boolean deleted=cacheFile.delete(); 

               Log.i("Deletion check","deleted:"+deleted); 
               sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); 

}

Manifest.xml 파일 :

Intent.ACTION_MEDIA_MOUNTED로 방송이되지 않으며 더 이상 허용되는 API의로 19 LVL
<uses-feature android:name="android.hardware.camera" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

<activity 
       android:name=".deleteRecord" 
       android:label="@string/app_name" > 
      <intent-filter> 
      <action android:name="com.refat.myexpensev1.DELETERECORD" /> 

      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
     <intent-filter> 
      <action android:name="android.intent.action.MEDIA_MOUNTED" /> 
     <data android:scheme="file" /> 
    </intent-filter> 
    </activity> 

답변

0

.

또한 권한이 없습니다. 매니페스트에 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />을 추가하여 휴대 전화의 외부 디렉토리에서 읽습니다.

+0

이미 매니페스트 파일에 추가 된 권한이 있습니다. 실제 장치에는없는 검은 색 프레임이없는 에뮬레이터에서 파일이 삭제됩니다. 가능한 해결책이 무엇인지 제안 해주세요. – user3737716

+0

API는 무엇입니까? – Boggartfly

+0
관련 문제