在我的類我有一個方法,搜索圖片庫中的圖片,也接收從手機相機拍攝的圖像,我現在需要保存此圖像在sqlite數據庫。我正在使用像BLOB這樣的數據庫字段,但不喜歡在bity []中序列化圖像或在decode64中轉換以寫入數據庫。如何將圖像保存到sqlite數據庫
我想知道如果任何人有任何實施例來傳遞xaramin機器人我張貼接收圖像的方法
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
// Make it available in the gallery
try
{
Intent mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
Uri contentUri = Uri.FromFile(App._file);
mediaScanIntent.SetData(contentUri);
SendBroadcast(mediaScanIntent);
// Display in ImageView. We will resize the bitmap to fit the display.
// Loading the full sized image will consume to much memory
// and cause the application to crash.
int height = Resources.DisplayMetrics.HeightPixels;
int width = imageView.Height;
App.bitmap = App._file.Path.LoadAndResizeBitmap(width, height);
if (App.bitmap != null)
{
imageView.SetImageBitmap(App.bitmap);
App.bitmap = null;
}
// Dispose of the Java side bitmap.
GC.Collect();
}
catch
{
}
try
{
if (resultCode == Result.Ok)
{
var imageView =
FindViewById<ImageView>(Resource.Id.imageView1);
imageView.SetImageURI(data.Data);
}
}
catch {
}
}
那你嘗試保存在數據庫中的項目? –