diff android/DWindows.kt @ 2474:a13e6db064f4

Android: Implement thread, semaphore, shared memory API functions. Implement dwmain() entrypoint and include dwtest.c in the build. Like on iOS dw_main() doesn't actually run the message loop... So wait for dw_main() to be called and return to the JVM.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 19 Apr 2021 23:06:25 +0000
parents aa420e366b2b
children 16d195d46f2a
line wrap: on
line diff
--- a/android/DWindows.kt	Sun Apr 18 01:28:55 2021 +0000
+++ b/android/DWindows.kt	Mon Apr 19 23:06:25 2021 +0000
@@ -1,27 +1,37 @@
 package org.dbsoft.dwindows.dwtest
 
-import androidx.appcompat.app.AppCompatActivity
 import android.os.Bundle
 import android.widget.TextView
+import androidx.appcompat.app.AppCompatActivity
 
-class DWindows : AppCompatActivity() {
-    override fun onCreate(savedInstanceState: Bundle?) {
+
+class DWindows : AppCompatActivity()
+{
+    override fun onCreate(savedInstanceState: Bundle?)
+    {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.dwindows_main)
 
+        val m = packageManager
+        var s = packageName
+        val p = m.getPackageInfo(s!!, 0)
+        s = p.applicationInfo.dataDir
+
         // Example of a call to a native method
-        findViewById<TextView>(R.id.sample_text).text = stringFromJNI()
+        findViewById<TextView>(R.id.sample_text).text = dwindowsInit(s)
     }
 
     /**
-     * A native method that is implemented by the 'dwindows' native library,
+     * Native methods that are implemented by the 'dwindows' native library,
      * which is packaged with this application.
      */
-    external fun stringFromJNI(): String
+    external fun dwindowsInit(dataDir: String): String
 
-    companion object {
+    companion object
+    {
         // Used to load the 'dwindows' library on application startup.
-        init {
+        init
+        {
             System.loadLibrary("dwindows")
         }
     }