Android implements the method of saving EditText content as Bitmap

  • 2021-01-18 06:37:40
  • OfStack

This article shows an example of how Android implements EditText content saved as Bitmap. To share with you for your reference, as follows:

The main code is as follows:


private void saveEidtTextAsBitmap() {
    if(mEditText == null)
      return;
    mEditText.setDrawingCacheEnabled(true);
    Bitmap bitmap = mEditText.getDrawingCache();
    if(bitmap != null) {
      saveBitmap(bitmap);
    } else {
      Toast.makeText(this, "save image error", Toast.LENGTH_SHORT).show();
      finish();
    }
}

More about Android controls related content interested readers can see the site: Android control usage summary

I hope this article is helpful to Android program design.


Related articles: