android 截图保存位置不在已选择的“SD卡”中

修改GlobalScreenshot.java的saveImageInBackgroundTask方法:
String imageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES).getAbsolutePath();

1、JB2修改为:
String imageDir = StorageManager.getDefaultPath() + '/' + Environment.DIRECTORY_PICTURES ;


2、JB3.TDD修改为:同时需要导入 import com.mediatek.storage.StorageManagerEx;
String imageDir = StorageManagerEx.getDefaultPath() + '/' + Environment.DIRECTORY_PICTURES ;

3、KK上修改为:
(1) import import com.mediatek.storage.StorageManagerEx;(2) mScreenshotDir = new File(StorageManagerEx.getDefaultPath() + "/" +
Environment.DIRECTORY_PICTURES , SCREENSHOTS_DIR_NAME) ;
(3) 在frameworks/ base/packages/SystemUI/AndroidManifest.xml添加如下code:
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />




android

你可能感兴趣的:(android 截图保存位置不在已选择的“SD卡”中)