Support
Quality
Security
License
Reuse
kandi has reviewed AirPlaneModeSwitcher and discovered the below as its top functions. This is intended to give you an instant insight into AirPlaneModeSwitcher implemented functionality, and help decide if they suit your requirements.
The main project: myAirPlaneMode
~~The switch compatLib reference: [SwitchCompatLibrary](https://github.com/ankri/SwitchCompatLibrary) used in [v0.2](https://github.com/tl3shi/AirPlaneModeSwitcher/tree/v0.2)~~
~~The actionbar compatLib reference: [actionbarsherlock](https://github.com/JakeWharton/ActionBarSherlock) used in [v0.2](https://github.com/tl3shi/AirPlaneModeSwitcher/tree/v0.2)~~
[Android手机定时切换飞行模式代码](http://www.tanglei.name/android-switch-airplanemode-1/)
2014-01-23 update: [Android 4.2 自动定时切换飞行模式](http://www.tanglei.name/android-airplanemode-auto-switcher/)
2015-01-18 update : [AutoSwither 1.0](http://www.tanglei.name/android-airplanemode-auto-switcher-v2/)
No Code Snippets are available at this moment for AirPlaneModeSwitcher.
QUESTION
Captured Image is not storing in android 11
Asked 2022-Mar-02 at 10:46I'm unable to store captured image in (getExternalFilesDir(Environment.DIRECTORY_PICTURES)) Android 11 device.
I have added
<uses-permissionandroid:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
in manifest and all file access also. But it's not working.
if (Build.VERSION.SDK_INT >= 30) {
if (!Environment.isExternalStorageManager()) {
try {
val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION)
intent.addCategory("android.intent.category.DEFAULT")
intent.data = Uri.parse(String.format("package:%s", applicationContext.packageName))
startActivityForResult(intent, 2296)
} catch (e: Exception) {
val intent = Intent()
intent.action = Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
startActivityForResult(intent, 2296)
}
}
}
This code is working below Android 11 device. But on Android 11 file is not creating File(context.getExternalFilesDir(Environment.DIRECTORY_PICTURES) .toString() + "/" + FolderName )
ANSWER
Answered 2021-Jul-31 at 10:25use this code for save captured image
String mPath = Environment.getExternalStorageDirectory() + "/Print";
Bitmap tmp = BitmapFactory.decodeFile(mPath);
File imageFile = new File(mPath);
FileOutputStream outStream;
try
{
outStream = new FileOutputStream(imageFile);
try
{
bitmap.compress(Bitmap.CompressFormat.JPEG, quality, outStream);
outStream.flush();
outStream.close();
} catch (IOException e)
{
e.printStackTrace();
}
} catch (Exception e)
{
e.printStackTrace();
}
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Save this library and start creating your kit