view android/DWindows.kt @ 2473:aa420e366b2b

Android: Initial skeletal commit for Android support, almost nothing implemented... but this should be a framework for adding Android support via JNI/NDK.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 18 Apr 2021 01:28:55 +0000
parents
children a13e6db064f4
line wrap: on
line source

package org.dbsoft.dwindows.dwtest

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView

class DWindows : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.dwindows_main)

        // Example of a call to a native method
        findViewById<TextView>(R.id.sample_text).text = stringFromJNI()
    }

    /**
     * A native method that is implemented by the 'dwindows' native library,
     * which is packaged with this application.
     */
    external fun stringFromJNI(): String

    companion object {
        // Used to load the 'dwindows' library on application startup.
        init {
            System.loadLibrary("dwindows")
        }
    }
}