学习Android闹钟源代码(一)-代码准备

因为本身的一个应用提醒是很重要的一部分,因此就得好好学习下Android自带的闹钟的实现了。android

android自带应用在源代码目录的package/apps目录下。git

闹钟应用的名字叫作DeskClock(说明:我下载的是android4.1的源代码)shell

(1)将DeskClock复制一份到工做目录中,app

 由于它自己不能直接导入到Eclipse中,咱们能够到其它的android项目中,将.project和.classpath(这两个是隐藏文件)学习

项目文件复制一份到DeskClock中。并手动打开修改。ui

 或者。像下面这样:使用android update project 命令来spa

banxi1988@banxi:~/android/tmp/DeskClock$ ls -a
.   AndroidManifest.xml  assets        .git                    NOTICE  src
..  Android.mk           CleanSpec.mk  MODULE_LICENSE_APACHE2  res     tests
banxi1988@banxi:~/android/tmp/DeskClock$

  

banxi1988@banxi:~/android/tmp/DeskClock$ android update project -p .  -s  -t 6
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using Activity name 'DeskClock'.
If you wish to change it, edit the first line of build.xml.
Added file ./build.xml
Added file ./proguard-project.txt
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using Activity name 'TestAddAlarm'.
If you wish to change it, edit the first line of build.xml.
Added file ./tests/build.xml
Added file ./tests/proguard-project.txt
banxi1988@banxi:~/android/tmp/DeskClock$ ls -a
.                    assets        local.properties        project.properties
..                   build.xml     MODULE_LICENSE_APACHE2  res
AndroidManifest.xml  CleanSpec.mk  NOTICE                  src
Android.mk           .git          proguard-project.txt    tests
banxi1988@banxi:~/android/tmp/DeskClock$

如今你发现了build.xml因而能够使用此文件在Eclipse中将项目导入了。android update project的具体使用参见其它文档。你懂的。code

 

而后,咱们就能够尝试编译运行DeskClock了。若是原来的虚拟机或者机子上已经有这个应用了,xml

那应该作出些修改。如更改包名等等。。ip

相关文章
相关标签/搜索