Android Java ビットマップ画像に変換 挿入

xml部分

---

<ImageView

    android:id="@+id/imageView"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    app:srcCompat="@drawable/matho"

    android:layout_weight="0.31" />

----

java

 

// イメージをビットマップデータに変換

Bitmap varBitmap = BitmapFactory.decodeResource( // ビットマップオブジェクトを生成

        // リソース取得

        getResources(),

        // 変換対象のイメージ

        R.drawable.matho);