Commit | Line | Data |
---|---|---|
9190adc6 MW |
1 | package uk.org.distorted.tripe; |
2 | ||
3 | import java.io.{File, FileOutputStream, InputStream, IOException}; | |
4 | ||
5 | import android.app.{Activity, Application}; | |
6 | import android.content.Context; import Context.MODE_WORLD_READABLE; | |
7 | import android.content.res.AssetManager; | |
8 | import android.os.Build; import Build.{CPU_ABI, CPU_ABI2}; | |
9 | import android.os.Bundle; | |
10 | import android.util.Log; | |
11 | import android.view.View; | |
12 | ||
13 | import scala.util.control.Breaks; | |
14 | ||
9190adc6 MW |
15 | |
16 | object ToyActivity { | |
17 | private final val TAG = "ToyActivity"; | |
18 | System.loadLibrary("jni"); | |
19 | @native protected def foo(); | |
20 | } | |
21 | ||
22 | class ToyActivity extends Activity { | |
23 | import ToyActivity._; | |
24 | ||
25 | override protected def onCreate(joy: Bundle) { | |
26 | super.onCreate(joy); | |
ad64fbfa | 27 | app.setup(this); |
9190adc6 | 28 | setContentView(R.layout.toy); |
0157de02 | 29 | Log.d(TAG, s"created ${this}"); |
9190adc6 MW |
30 | } |
31 | def clickOk(v: View) { | |
32 | Log.d(TAG, "OK, OK. (Scala was here.)"); | |
33 | foo(); | |
34 | ||
35 | val bindir = getDir("bin", MODE_WORLD_READABLE); | |
36 | Runtime.getRuntime.exec(Array(new File(bindir, "prog").getPath, | |
37 | "testing", "1", "2", "3")); | |
38 | } | |
39 | } |