上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页
摘要: 根据http://blog.csdn.net/v_JULY_v/article/details/6322882 敲的。//main函数开始main(){ char str[] = "123456"; move(str, 6, 4); printf("%s \n", str);}move(char str[], int length, int x){ fanZhuan(str, 0, length - x - 1); fanZhuan(str, length - x, length - 1); fanZhuan(str, 0, length - 1);}f 阅读全文
posted @ 2014-02-24 20:02 yutoulck 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 首先我们要知道是怎么从C/C++跳到JAVA世界里的。首先,zygote是C世界里从init通过fork出来的一个进程,它执行了它的main,而在main里又很重要地执行了AppRuntime的start(),AppRuntime的start()主要:1、启动了虚拟机以;2、注册了JNI环境;3、利用JNI执行了JAVA类ZygoteInit的main。从此进入了JAVA世界。那么ZygoteInit的main是怎样的?1、它建立了一个IPC的socket通信;2、预加载了资源和类;3、再次fork,新进程就是system_server;4、利用之前建立的socket来进行服务——客户通信。接 阅读全文
posted @ 2013-12-12 20:48 yutoulck 阅读(444) 评论(0) 推荐(0) 编辑
摘要: init是安卓也是linux的第一个进程,进程号为1.首先它会先解析init.rc。首先,解析得到的内容会以section为单位,只有On或者是service关键词算是一个section。zygote是一个service section,在这个section里面定义了zygote,系统有一个service结构体来存放service section,service结构体里面包含一个action结构体。解析后service section的执行命令就会被存放在action结构体里面。然后,会通过相关的命令,通过service结构体来实现zygote,一般就是通过fork命令创建进程然后使用exec 阅读全文
posted @ 2013-12-11 22:21 yutoulck 阅读(201) 评论(0) 推荐(0) 编辑
摘要: JNI层必须实现为动态库,才能被虚拟机加载并调用,一般命名为:lib模块名_jni.so。JNI的实现有两个点:1、在native方法调用前被加载,一般是在static{}里面使用System.loadLibrary(),动态库名与实际操作的名不一样,因为系统会自动匹配;2、用native声明的函数表示该函数即将会从JNI里完成。(被调用的JNI函数必须先声明,类似C语言)JNI的注册主要是通过方法名字来进行相关联系的,例如如果在android.media.test有一个方法Init(),那么全名就是android.media.test.Init(),在JNI的库函数里,因为“.”有特殊意义所 阅读全文
posted @ 2013-12-11 20:56 yutoulck 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 目的:大概了解下HAL在android中的作用以及应用,阅读:Android硬件抽象层(HAL)系列文章:http://blog.csdn.net/luoshengyang/article/details/6567257首先作者先自己写了一个虚拟设备,并且为其编写了驱动程序。接下来为了测试写了一个基于C的测试程序。然后接下来的工作都是为了从Application Framework使用JAVA来进行操作。首先,增加硬件抽象层(HAL)模块来访问Linux内核驱动程序;第二,为Android硬件抽象层接口编写JNI方法,以便使得上层的Java应用程序能够使用下层提供的硬件服务;第三,继续网上一层 阅读全文
posted @ 2013-12-05 21:55 yutoulck 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 阅读:http://www.cnblogs.com/dwj-blog/p/3276937.html 阅读全文
posted @ 2013-12-02 16:50 yutoulck 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 阅读:http://developer.android.com/training/secure-file-sharing/index.html首先要先注册一个FileProvider。 ... authorities必须是自己程序的包名+fileprovider,resource对应的是下面即将提到的路径问题。 In this example, the tag shares directories within the files/ directory of your app's internal st... 阅读全文
posted @ 2013-12-01 19:19 yutoulck 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 阅读:http://developer.android.com/training/sharing/index.html最简单的就是用包含ACTION_SEND 的 INTENT了,ACTION_SEND表示不同Activity的交流Intent sendIntent = new Intent();sendIntent.setAction(Intent.ACTION_SEND);sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");sendIntent.setType("text/pla 阅读全文
posted @ 2013-12-01 18:35 yutoulck 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 阅读:http://www.kuqin.com/shuoit/20131129/336617.html 阅读全文
posted @ 2013-11-30 21:51 yutoulck 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 阅读:http://developer.android.com/training/gestures/index.html先直接上代码:public class MainActivity extends Activity {...// This example shows an Activity, but you would use the same approach if// you were subclassing a View.@Overridepublic boolean onTouchEvent(MotionEvent event){ int action = ... 阅读全文
posted @ 2013-11-20 23:07 yutoulck 阅读(185) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页