MainActivity.kt package com.cfsuman.kotlintutorials import android.app.Activity import android.content.Context import android.graphics.* import android.os.Bundle import android.widget.* import java.io.IOException class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // get the widgets reference from XML layout val imageView = findViewById<ImageView>(R.id.imageView) val textView2 = findViewById<TextView>(R.id.textView2) // get the bitmap from assets folder val bitmap = assetsToBitmap("flower103.jpg") bitmap?.apply { // show original bitmap in first image view imageView.setImageBitmap(this) // set bitmap shader as text view paint textView2.paint.shader = toBitmapShader() } } } // extension function to get bitma...
Android, .NET C#, Flutter, and Many More Programming tutorials.