Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
2473:aa420e366b2b | 2474:a13e6db064f4 |
---|---|
1 package org.dbsoft.dwindows.dwtest | 1 package org.dbsoft.dwindows.dwtest |
2 | 2 |
3 import androidx.appcompat.app.AppCompatActivity | |
4 import android.os.Bundle | 3 import android.os.Bundle |
5 import android.widget.TextView | 4 import android.widget.TextView |
5 import androidx.appcompat.app.AppCompatActivity | |
6 | 6 |
7 class DWindows : AppCompatActivity() { | 7 |
8 override fun onCreate(savedInstanceState: Bundle?) { | 8 class DWindows : AppCompatActivity() |
9 { | |
10 override fun onCreate(savedInstanceState: Bundle?) | |
11 { | |
9 super.onCreate(savedInstanceState) | 12 super.onCreate(savedInstanceState) |
10 setContentView(R.layout.dwindows_main) | 13 setContentView(R.layout.dwindows_main) |
11 | 14 |
15 val m = packageManager | |
16 var s = packageName | |
17 val p = m.getPackageInfo(s!!, 0) | |
18 s = p.applicationInfo.dataDir | |
19 | |
12 // Example of a call to a native method | 20 // Example of a call to a native method |
13 findViewById<TextView>(R.id.sample_text).text = stringFromJNI() | 21 findViewById<TextView>(R.id.sample_text).text = dwindowsInit(s) |
14 } | 22 } |
15 | 23 |
16 /** | 24 /** |
17 * A native method that is implemented by the 'dwindows' native library, | 25 * Native methods that are implemented by the 'dwindows' native library, |
18 * which is packaged with this application. | 26 * which is packaged with this application. |
19 */ | 27 */ |
20 external fun stringFromJNI(): String | 28 external fun dwindowsInit(dataDir: String): String |
21 | 29 |
22 companion object { | 30 companion object |
31 { | |
23 // Used to load the 'dwindows' library on application startup. | 32 // Used to load the 'dwindows' library on application startup. |
24 init { | 33 init |
34 { | |
25 System.loadLibrary("dwindows") | 35 System.loadLibrary("dwindows") |
26 } | 36 } |
27 } | 37 } |
28 } | 38 } |