07 2012 档案
摘要:正则表达式(regular expression)就是用一个“字符串”来描述一个特征,然后去验证另一个“字符串”是否符合这个特征。比如 表达式“ab+” 描述的特征是“一个 'a' 和 任意个 'b' ”,那么 'ab', 'abb', 'abbbbbbbbbb' 都符合这个特征。 正则表达式可以用来:(1)验证字符串是否符合指定特征,比如验证是否是合法的邮件地址。(2)用来查找字符串,从一个长的文本中查找符合指定特征的字符串,比查找固定字符串更加灵活方便。(3)用来替换,比普通的替换更强大。1. 正则表达式规则1
阅读全文
摘要:For the detail of JNI functions:http://www.public.iastate.edu/~java/docs/guide/nativemethod/functions.doc.html#173141.The Definition about JNIEnv is different in C and C++.#if defined(__cplusplus)typedef _JNIEnv JNIEnv; typedef _JavaVM JavaVM; #else typedef const struct JNINativeInterfac...
阅读全文
摘要:An Android.mk file is written to describe your sources to the build system. More specifically:- The file is really a tiny GNU Makefile fragment that will be parsed one or more times by the build system. As such, you should try to minimize the variables you declare there and do not assume that anythi
阅读全文
摘要:For detail:<ndk>/docs/android-mk.html一个Android.mk file用来向编译系统描述你的源代码。具体来说:该文件是GNU Makefile的一小部分,会被编译系统解析一次或多次。你可以在每一个Android.mk file中定义一个或多个模块,你也可以在几个模块中使用同一个源代码文件。编译系统为你处理许多细节问题。例如,你不需要在你的Android.mk中列出头文件和依赖文件。NDK编译系统将会为你自动处理这些问题。这也意味着,在升级NDK后,你应该得到新的toolchain/platform支持,而且不需要改变你的Android.mk文件
阅读全文
摘要:1.j***Array<->***[] (c++,not C)you can use jsize theArrayLength = env->GetArrayLength(arraySrc);to get the length of the array;jbyteArray->BYTE[] #define BYTE unsigned charjbyte * arrayTemp=env->GetByteArrayElements(arraySrc,0);//arraySrc is jbyteArray BYTE *arrayRet= (BYTE *)arrayTem
阅读全文
摘要:For the detail of JNI functions: http://www.public.iastate.edu/~java/docs/guide/nativemethod/functions.doc.html#17314Note:1.TheDefinition aboutJNIEnvis different in C and C++.#if defined(__cplusplus)typedef _JNIEnv JNIEnv;typedef _JavaVM JavaVM;#elsetypedef const struct JNINativeInterface* JNIEnv;t.
阅读全文
摘要:1.write filevoid outputFile(long time){ char buf[128]; int n=sprintf(buf,"%d",time);//write the content to buffer first! buf[n]=0; FILE *stream; stream= fopen( "./time.txt", "w+b" ); fwrite(buf, 1,n, stream ); fclose(stream);}fwrite(buf, 1,n, stream ); buf: the content
阅读全文
摘要:You may have ever come across this problom:While you are importing a project from somewhere,the hint says it contains error(s),but you can find any error sign.Then you cancheck up the build path:right click->properties->Java Build PathFix the errors first!
阅读全文
摘要:View the version of Proguard:1.open command window of windows.2.enter the folder of proguard,step intobindirectory.cd <your SDK path>\android-sdk\tools\proguard\bin3.runproguard A.Normal Condition Set theconfiguration file for progurad inproject.properties:# This file is automatically generate
阅读全文
摘要:在Test目录下 输入 上面的命令,列出如上:第一列X-XXX-XXX-XXX,这里显示的就是文件的权限。w : 可写 r : 可读 x : 可执行第二列的数字连接着文件系统的i-node第三列的firefox是文件持有的用户第四列的firefox是文件持有的用户组第五列是文件大小,单位是B后面的比较简单,不介绍了。对于第一列的第一个X (字符)代表这个文件是目录或者是文件或者是链接文件[d]:目录 [-] : 文件 [l] : 链接文件紧接着的XXX代表的是用户对文件操作的权限,接下来的XXX代表用户组对文件操作的权限,最后三个XXX是others对文件操作的权限。拿第一个 hello文..
阅读全文
摘要:java:package com.nan.callback;import android.app.Activity;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.view.View;import android.widget.Button;import android.widget.TextView;public class MyCallbackActivity extends Activity{ private Button intButton = ...
阅读全文
摘要:为了实现android的二次开发,希望通过编制动态链接库(.so)的方式实现android native C程序的调用。更为实际的情况则是:编制新库(new.so)调用android的老库(如libskia.so libskiagl.so)。以图形库skia为例,具体过程如下: 1.下载完整的skia代码,代码自己到google上搜吧(重要提示:wiki,TortoiseSVN)(更重要的提示:这步可以跳过,如果你的开发与硬件驱动无关的话) 2.通过git下载android源码:xxxx/core,xxxx/base,xxxx/skia三个文件夹就够了。(重要提示:xxxx我也忘了代表...
阅读全文
摘要:Note: 1.文件头尾:1G到第一行,G到最后一行 Ctrl+Home:文件开始 Ctrl+End:文件结束 Shift+Home:行开始 Shift+End:行结束四个步骤:存活感觉良好觉得更好,更强,更快使用VIM的超能力当你走完这篇文章,你会成为一个vim的 superstar。在开始学习以前,我需要给你一些警告:学习vim在开始时是痛苦的。需要时间需要不断地练习,就像你学习一个乐器一样。不要期望你能在3天内把vim练得比别的编辑器更有效率。事实上,你需要2周时间的苦练,而不是3天。第一级 – 存活安装vim启动 vim什么也别干!请先阅读当你安装好一个编辑器...
阅读全文
摘要:基础样例1)C部分1.1)TestJni.h/* * TestJni.h * * Created on: 2011-12-20 * Author: Join */ #ifndef TESTJNI_H_ #define TESTJNI_H_ #include <jni.h> #include <stdio.h> #include <stdlib.h> #include <android/log.h> #include <android/bitmap.h> // 测试回调Java #include "CallJava.h&quo
阅读全文
摘要:From the detail ofandroid Git repositories,seehttps://android.googlesource.com/git clone git://Android.git.kernel.org/device/common.gitgit clone git://Android.git.kernel.org/device/htc/common.gitgit clone git://Android.git.kernel.org/device/htc/dream-sapphire.git git clone git://Android.git.kernel.o
阅读全文
摘要:git是免费的开源的分布式的版本控制系统。我说的直白点,要强调的点是每个git clone下来的版本库都是一个完整的版本库,包括所有的历史记录和版本信息,不需要依赖网络,这点在使用的过程中你一定会有感触,git不是盖的。git很快,但是这点我没有大的感觉;git易于使用,相对svn而言,我不觉得git比之简单,但是总体来说git还是比较容易的,尤其是服务器端的部署非常简易。本文仅仅介绍一下git的简单使用。关于一些不常用的东西尽量会过滤掉。1.基本命令。?123456789101112131415161718/***这里列举几个常见的git命令,让大家过过目**/1)基本操作>git i
阅读全文
摘要:Git 是 Linux Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的分布式版本控制软件,它不同于Subversion、CVS这样的集中式版本控制系统。在集中式版本控制系统中只有一个仓 库(repository),许多个工作目录(working copy),而像Git这样...
阅读全文
摘要:Reprinted fromhttp://www.ibm.com/developerworks/cn/opensource/tutorials/os-androidndk/section5.htmlFirst ,we will useandroid/bitmap.h,so thelowest ver...
阅读全文
摘要:Source:http://blog.csdn.net/hellogv/archive/2010/12/23/6094127.aspx在Android上使用JAVA实现彩图转换为灰度图,跟J2ME上的实现类似,不过遇到频繁地转换或者是大图转换时,就必须使用NDK来提高速度了。本文主要通过JAVA和NDK这两种方式来分别实现彩图转换为灰度图,并给出速度的对比。 从转换灰度图的耗时来说,NDK的确比JAVA所用的时间短不少。主程序testToGray.java的源码如下:package com.testToGray;import android.app.Activity;import a...
阅读全文
摘要:Format the time:SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String date = sDateFormat.format(new java.util.Date()); For Detail ,consulthttp://developer.android.com/reference/android/text/format/DateFormat.htmljava.text.DateFormatjava.text.format.DateFormatFo
阅读全文
摘要:For example :List<? extends HasWord> wordList = toke.tokenize();?extendsHasWordmeans "A class that extendsHasWord." In other words,HasWorditself or any of its children... basically anything that would work withinstanceof HasWord.In more technical terms,? extends HasWordis a bounded w
阅读全文
摘要:一.Android版本与Linux内核的关系 英文名 中文名 版本号 API level 发布时间 内核版本 以下是每个版本的详细分支,比如安卓4.4-kitkat,内部还有分支,分为4.4.1,4.4.2等等,下载的时候最好下载一个分支就好了,不然容量太大。 二.下载源码分为2大部分 1.Andr
阅读全文
摘要:Eclipse IDE for C/C++ Developers+CygwinEclipse Classic + Cygwin + CDTEclipse Classic + Cygwin + CDT + NDK ->Android so LibShow Chinese in CygwinA Project For TestSoftware Version: Cygwin 1.7.15-1 Eclipse IDE for C/C++ Developers(Juno) Eclipse Classic 4.2(Juno) CDT 8.1.0 for Eclipse Juno Androi...
阅读全文
摘要:Android系统里面有3种类型的菜单:options menu,context menu,sub menu。options menu 按Menu键就会显示,用于当前的Activity。 它包括两种菜单项: 因为options menu在屏幕底部最多只能显示6个菜单项,这些菜单项称为icon menu,icon menu只支持文字(title) 以及icon,可以设置快捷键,不支持checkbox以及radio控件,所以不能设置checkable选项。 而多于6的菜单项会以“more” icon menu来调出,称为expanded menu。它不支持icon,其他的特性都和ico...
阅读全文

浙公网安备 33010602011771号