WEB开发网
开发学院手机开发Android 开发 Android NDK入门、提高和实战 阅读

Android NDK入门、提高和实战

 2010-08-21 06:22:00 来源:WEB开发网   
核心提示:b.x = 5;b.y = 5;float d = distance(a,b);tv.setText("distance(a,b):"+d);setContentView(tv);}public native float distance(Point a, Point b);static {Syst

b.x = 5;

b.y = 5;

float d = distance(a,b);

tv.setText("distance(a,b):"+d);

setContentView(tv);

}

public native float distance(Point a, Point b);

static {

System.loadLibrary("demo");

}

}

public class Main extends Activity {

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

TextView tv = new TextView(getApplicationContext());

Point a = new Point();

a.x = 3;

a.y = 3;

Point b = new Point();

b.x = 5;

b.y = 5;

float d = distance(a,b);

tv.setText("distance(a,b):"+d);

setContentView(tv);

}

public native float distance(Point a, Point b);

static {

System.loadLibrary("demo");

}

}

运行,得到结果distance(a,b):2.828427

上一页  1 2 3 4 

Tags:Android NDK 入门

编辑录入:coldstar [复制链接] [打 印]
赞助商链接