これまでandroid 4.0(IceCream Sandwich)に未対応で、
Galaxy Nexusにはインストール不可能でした。
それが昨日4.0に対応したというニュースが出ました。
そこで、実際にインストールして見ました。
やーっと、CNET TVが見られる!嬉しい!ちゃんと動いた。
子供たちが絵を描くようにプログラムを書いたりDJしたり作曲したりして遊ぶアプリを作ろうとしています。今はAndroidで鋭意製作中。 (c) Hiroyuki Osaki [since 2000]
class a { a() { } String getname() { return "this is a."; } } class b extends a { b() { super(); } String getname() { return super.getname()+"but this is also b"; } } Class bclazz = b.class; a bx = new a(); try { bx = bclazz.newInstance(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } if(bx instanceof b) Log.w("Test", "this is instanceof b"); if(bx instanceof a) Log.w("Test", "this is instanceof a"); Log.w("Test", bx.getname());
class a { a() { } String getname() { return "this is a."; } } class b extends a { b() { super(); } String getname() { return super.getname()+"but this is also b"; } } Class bclazz = b.class; a bx = new a(); try { bx = bclazz.newInstance(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } Log.w("Test", bx.getname());
package hello import ( "fmt" "http" ) func init() { http.HandleFunc("/", handler) } func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello, world!") }私は匿名関数を何かと使いたがるので、下記のように書き換えてしまいます。
package hello import ( "fmt" "http" ) func init() { http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) () { fmt.Fprint(w, "Hello, world!") }) }
wget http://sourceforge.net/projects/sysbench/files/sysbench/0.4.12/sysbench-0.4.12.tar.gz
apt-get install mysql-devel
-->Error
apt-get install libmysql++-dev
hiro@ubuntu:~/sysbench/src/sysbench-0.4.12$ libtoolize --force --copy
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `config'.
libtoolize: copying file `config/ltmain.sh'
libtoolize: You should add the contents of the following files to `aclocal.m4':
libtoolize: `/usr/share/aclocal/ltversion.m4'
libtoolize: `/usr/share/aclocal/ltsugar.m4'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
========================================================================
BYTE UNIX Benchmarks (Version 5.1.2)
System: ubuntu: GNU/Linux
OS: GNU/Linux -- 2.6.32-25-generic -- #45-Ubuntu SMP Sat Oct 16 19:52:42 UTC 2010
Machine: x86_64 (unknown)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Core(TM) i5 CPU 650 @ 3.20GHz (6383.6 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
04:09:42 up 8 days, 4:00, 2 users, load average: 0.16, 0.21, 0.18; runlevel 2
------------------------------------------------------------------------
Benchmark Run: Mon Jan 10 2011 04:09:42 - 04:37:47
1 CPU in system; running 1 parallel copy of tests
Dhrystone 2 using register variables 33669499.9 lps (10.0 s, 7 samples)
Double-Precision Whetstone 4066.7 MWIPS (9.9 s, 7 samples)
Execl Throughput 4711.2 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 887767.4 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 307965.2 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 1596808.8 KBps (30.0 s, 2 samples)
Pipe Throughput 2302810.2 lps (10.0 s, 7 samples)
Pipe-based Context Switching 418146.4 lps (10.0 s, 7 samples)
Process Creation 14305.6 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 6419.8 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 802.4 lpm (60.0 s, 2 samples)
System Call Overhead 4276356.3 lps (10.0 s, 7 samples)
System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 33669499.9 2885.1
Double-Precision Whetstone 55.0 4066.7 739.4
Execl Throughput 43.0 4711.2 1095.6
File Copy 1024 bufsize 2000 maxblocks 3960.0 887767.4 2241.8
File Copy 256 bufsize 500 maxblocks 1655.0 307965.2 1860.8
File Copy 4096 bufsize 8000 maxblocks 5800.0 1596808.8 2753.1
Pipe Throughput 12440.0 2302810.2 1851.1
Pipe-based Context Switching 4000.0 418146.4 1045.4
Process Creation 126.0 14305.6 1135.4
Shell Scripts (1 concurrent) 42.4 6419.8 1514.1
Shell Scripts (8 concurrent) 6.0 802.4 1337.3
System Call Overhead 15000.0 4276356.3 2850.9
========
System Benchmarks Index Score 1625.6
GradientDrawable mGradient = new GradientDrawable(
Orientation.LEFT_RIGHT,
new int[] { 0xff303030, 0xff777777 });
mGradient.setBounds(new Rect(0,0,getWidth()/2,getHeight()));
mGradient.draw(canvas);
Viewを制御できるのはシングルスレッド
Handlerというキューを作る。そこにView制御をキューイングしておく。
Thread th = new Thread() {
public void run() {
mHandler.post(new Runnable() {
public void run() {
Canvas canvas = getHolder().lockCanvas();
if (canvas != null) {
onDraw(canvas);
getHolder().unlockCanvasAndPost(canvas);
}
}
});
}
};
http://goo.gl/vXLg8 通常のViewではHandlerを用いて画面更新を依頼することになるのですが、SurfaceViewでは自分で用意したThreadの中でCanvasを取得して画面領域をロックして、描画を終わったら一気に更新ということが可能です。
Thread th = new Thread() {
public void run() {
Canvas canvas = getHolder().lockCanvas();
if (canvas != null) {
onDraw(canvas);
getHolder().unlockCanvasAndPost(canvas);
}
}
};