mirror of
https://github.com/bitwarden/mobile
synced 2025-12-13 06:43:17 +00:00
attachments page
This commit is contained in:
30
src/Android/Utilities/AndroidHelpers.cs
Normal file
30
src/Android/Utilities/AndroidHelpers.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Android.Content;
|
||||
using Android.Provider;
|
||||
|
||||
namespace Bit.Droid.Utilities
|
||||
{
|
||||
public static class AndroidHelpers
|
||||
{
|
||||
public static string GetFileName(Context context, Android.Net.Uri uri)
|
||||
{
|
||||
string name = null;
|
||||
string[] projection = { MediaStore.MediaColumns.DisplayName };
|
||||
var metaCursor = context.ContentResolver.Query(uri, projection, null, null, null);
|
||||
if(metaCursor != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(metaCursor.MoveToFirst())
|
||||
{
|
||||
name = metaCursor.GetString(0);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
metaCursor.Close();
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user