如何在xamarin android上将ProfilePictureView转换为位图



我能够在我的xamarin应用程序中集成facebook认证并设法获得facebook图像到profileimageview和其他信息,如姓名和电子邮件。

我已经检查了是否有一个现有的线程,并从那里尝试了解决方案,但是从它的方法在API 26

这里是方法

ImageView imageView = (ImageView)pic.getChildAt(0);
Bitmap bmp = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
image_ = convertImageToByte(bmp);

基于文档getDrawable()已在api22折旧

是否有其他的工作来排序这个?

我的目标是从中获取位图并将其保存为base64字符串到firebase。

您可以检查以下代码

ImageView imageView =new ImageView(this);
Bitmap bitmap = ((BitmapDrawable)imageView.Drawable).Bitmap as Bitmap;
MemoryStream baos = new MemoryStream();
bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100, baos);
byte[] imageInByte = baos.ToArray();

相关内容

  • 没有找到相关文章

最新更新