I am working on xamarin.android and use Marshmallow device. I use Intent to open files and selecting up to 1200 files is working fine but when I select 1475 files, it hangs and when I debug this, it also closed.
Here is the Intent, I had used
var Intent = new Intent();
Intent.SetType("image/*");
Intent.PutExtra(Intent.ExtraAllowMultiple, true);
Intent.SetAction(Intent.ActionGetContent);
StartActivityForResult(Intent, 2);
My application should not have any limitation of adding files. Is there any limitation in android device?
Do correct me, where I am doing wrong
Edit:
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
if ((requestCode == 2) && (resultCode == Result.Ok) && (data != null))
{
//------------- taking permission for the opened uri
var takeFlags = ActivityFlags.GrantReadUriPermission | ActivityFlags.GrantWriteUriPermission;
// Check for the freshest data.
try
{
if (data.Data != null)
{
GrantUriPermission(PackageName, data.Data, ActivityFlags.GrantReadUriPermission | ActivityFlags.GrantWriteUriPermission);
ContentResolver.TakePersistableUriPermission(data.Data, takeFlags);
}
}
catch { }
var ar = data.ClipData;
if (ar != null)
{
clipDataImages = ar;
// in the below activity, I had used separate thread for loading to Recycler view, but it did not start the LoadImageActivity
StartActivity(typeof(LoadImageActivity));
}
}
}