TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Devendra Kumar
NA
500
163.4k
External storage access denied in xamarin android
Jan 19 2018 3:22 AM
Hello all
I just started building apps using xamarin.android and I got stuck in between.
I am working with images and uses the compress function of bitmap and when I read/write image on phone memory, it works fine but when I tried to write on ezxternal sd card, it shows access denied exception, although reading from it is working fine.I had also set the permission of ReadExternalStorage and WriteExternalStorage but still getting the exception.
Here is my code
// Path of PhotoUri and path that I retreived
//var PhotoUri = {content://com.android.providers.media.documents/document/image%3A9104}
//var path = /storage/D660-18BD/memorytest/20170930_230230.jpg
using
(var bmp = MediaStore.Images.Media.GetBitmap(ContentResolver, PhotoUri))
{
var fullPath = System.IO.Path.GetFullPath(path);
var dirName = System.IO.Path.GetDirectoryName(fullPath);
var filename = System.IO.Path.GetFileNameWithoutExtension(fullPath);
var ext = System.IO.Path.GetExtension(fullPath);
var newname = System.IO.Path.Combine(dirName, filename +
"IR"
+ ext);
var fs =
new
FileStream(newname, FileMode.OpenOrCreate);
// here I got the exception
bmp.Compress(Bitmap.CompressFormat.Jpeg, 90, fs);
fs.Close();
fs.Dispose();
}
Access to the path "/storage/D660-18BD/memorytest/20170930_230230IR.jpg" is denied.
Can anyone help me to get the solution.
Reply
Answers (
2
)
Android Wear App
About google map in android