首页 > 代码库 > android jni 学习之一 <资料转载>

android jni 学习之一 <资料转载>

先把自己找的资料贴在这里,感谢作者分享!

http://blog.csdn.net/jianguo_liao19840726/article/details/6719224

 简而言之:

1 android(java)代码中的本地方法列表(c/c++ 库提供的API),示例如下:

public class DataProvider {    private static final class DataProviderHolder {        private static final DataProvider instance = new DataProvider();    }    private DataProvider() {    }    public static DataProvider getInstance() {        return DataProviderHolder.instance;    }/*本地方法实例一*/    public synchronized native int Operator(String deviceMac, int deviceType,            int state);/*本地方法实例二*/    public synchronized native int OperatorCmd(String deviceMac,            int deviceType, int cmd, int state);/*本地方法实例三*/    public synchronized native String OperatorCmdString(String deviceMac,            int deviceType, int cmd, int state);/*本地方法实例四*/    public native int OpenTty(String serialPort);/*开始呼唤上面列出来的本地实例*/    public synchronized native String WriteDevice(String value,int type,int cmd,int val);    static {        System.loadLibrary("zigbee_r_lock");    }}

 

android jni 学习之一 <资料转载>