Radu Bogdan Claudiu
Lurker
Hi boys,
I'm using VS 2015 Android Native so it's the same as Android Studio only Syntax changing cause i'm using C# and you Java.
I'm trying to show an image from internal storage to ImageView
The error is telling me that i must grant Manifest.Permission.ManageDocuments permission, that I've granted in manifest file.
before calling that function I have used
and on requestpermissionresult that handle the result
The problem is the grantResult array is populated with permission.Deny.
1) I've looked at Application permissions in settings-> application-> App Name-> permissions and is granted..#
please help me..
The URI is correct and image exists...
I'm using VS 2015 Android Native so it's the same as Android Studio only Syntax changing cause i'm using C# and you Java.
I'm trying to show an image from internal storage to ImageView
Code:
var itemURL = Android.Net.Uri.Parse("content://com.android.providers.media.documents/document/image:20421");
var input = context.ContentResolver.OpenInputStream(itemURL);
convertView.FindViewById<ImageView>(Resource.Id.Galleria_Menu_ImgLast).SetImageBitmap(BitmapFactory.DecodeStream(input));
The error is telling me that i must grant Manifest.Permission.ManageDocuments permission, that I've granted in manifest file.
before calling that function I have used
Code:
if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ManageDocuments) != Permission.Granted)
{
if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.ManageDocuments))
{
}
else
{
ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.ManageDocuments }, 198);
}
}
and on requestpermissionresult that handle the result
Code:
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
{
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode)
{
case 198:
{
// If request is cancelled, the result arrays are empty.
if (grantResults.Length > 0 && grantResults[0] == Permission.Granted)
{
// permission was granted, yay! Do the
// contacts-related task you need to do.
FillList();
}
else
{
// permission denied, boo! Disable the
// functionality that depends on this permission.
}
break;
}
// other 'case' lines to check for other
// permissions this app might request
}
}
The problem is the grantResult array is populated with permission.Deny.
1) I've looked at Application permissions in settings-> application-> App Name-> permissions and is granted..#
please help me..
The URI is correct and image exists...
