01 2014 档案

摘要:#include #include int a = 0; //全局初始化区char *p1; //全局未初始化区int main(){ /************************************************************* * C语言变量声明及内存分配 * * 一个由C/C++编译的程序占用的内存分为以下几个部分 * * 1、栈区(stack) * 程序运行时由编译器自动分配,存放函数的参数值,局部变量的值等。 * 其操作方式类似于数据结构中的栈。程序结束时由编译器自动释放。... 阅读全文
posted @ 2014-01-24 14:26 天之涯0204 阅读(174) 评论(0) 推荐(0)
摘要:#include #include #include int main(){ /************************************************************* * C语言之动态内存分配函数malloc,calloc,realloc,memset * * malloc: void *malloc(size_t size) * 包含在库函数stdlib.h中,作用是在内存的堆区分配一个大小为size * 的连续空间,如果分配内存成功,函数返回新分配内存的首地址,否则,... 阅读全文
posted @ 2014-01-24 13:27 天之涯0204 阅读(358) 评论(0) 推荐(0)
摘要:#include int main(){ /************************************************************* * C语言之const * 看到const关键字,很多人想到的可能是const常量,其实关键字const并不能把变量变成常量! * 在一个符号前加上const限定符只是表示这个符号不能被赋值。也就是它的值对于这个符号来说是 * 只读的,但它并不能防止通过程序的内部(甚至是外部)的方法来修改这个值(C专家编程.p21)。也 * 就是说const变量是只读变量,既然是变量那么就... 阅读全文
posted @ 2014-01-24 10:02 天之涯0204 阅读(884) 评论(0) 推荐(0)
摘要:#include void test();int main(){ /************************************************************* * static和局部变量 * static修饰局部变量: * 1、 延长局部变量的生命周期:程序结束的时候,局部变量才会被销毁 * 2、并没有改变局部变量的作用域,也就是外部不能访问该变量 * 3、 所有的局部变量所在的函数都共享着一个static变量 * ***************************... 阅读全文
posted @ 2014-01-23 21:29 天之涯0204 阅读(313) 评论(0) 推荐(0)
摘要:#include //默认全局变量为外部变量int a;//当全局变量前面加上static时,该变量为内部变量static int b;void test();int main(){ /************************************************************* * extern static和全局变量 * 全局变量分2种: * 外部变量:定义的变量能被本文件和其他文件访问 * 1、 默认情况下,所有的全局变量都是外部变量 * 2、 不同文件中的... 阅读全文
posted @ 2014-01-23 21:23 天之涯0204 阅读(384) 评论(0) 推荐(0)
摘要:#include int sum(int a, int b);int main(){ /************************************************************* * extern static和函数 * 函数可以分为外部函数和内部函数: * 外部函数:定义的函数能被本文件和其他文件访问 * 1、 默认情况下所有函数都是外部函数 * 2、 不允许有同名的外部函数,即就是几个不同的文件中不能出现相同名字的函数 * 内部函数:定义的函数只能被本文件访问,其他... 阅读全文
posted @ 2014-01-23 21:13 天之涯0204 阅读(461) 评论(0) 推荐(0)
摘要:#include //基本类型typedef int MyInt;//可以对typedef产生的类型名二次起别名typedef MyInt MyInt2;// 给指针类型char *起一个新的类型名称Stringtypedef char * String;//给结构体定义别名//方法一:先定义类型,再声明别名struct Student1{ int age;};typedef struct Student1 MyStu1;//方法二:定义类型的同时声明别名typedef struct Student2{ int age;} MyStu2;//方法三:定义类型的同时声明别名,此时省... 阅读全文
posted @ 2014-01-23 21:00 天之涯0204 阅读(329) 评论(0) 推荐(0)
摘要:c = 21#include #include "A.h"int main(){ /************************************************************* * 预处理指令: * 1.C语言在对源程序进行编译之前,会先对一些特殊的预处理指令作解释 * (比如之前使用的#include文件包含指令),产生一个新的源程序(这个过程称为编译预处理), * 之后再进行通常的编译 * 2.为了区分预处理指令和一般的C语句,所有预处理指令都以符号"#"开头,并且结尾不用分号 * ... 阅读全文
posted @ 2014-01-23 17:14 天之涯0204 阅读(520) 评论(0) 推荐(0)
摘要:TEST 10TEST 10TEST 10TEST 10 阅读全文
posted @ 2014-01-23 16:54 天之涯0204 阅读(157) 评论(0) 推荐(0)
摘要:#include //定义不带参数的宏#define PI 3.14/******************************************************** * 定义带参数的宏,#define和Pow(a)之间有个空格,Pow和(a)之间不能存在空格 * Pow(a)和 ( (a) * (a) )之间有一个空格,参数应该用括号括住,结果也应该用 * 括号括住,因为编译前,预处理只是对宏进行替换,真正执行时有可能会因为参数的形式出 * 现不可预知的错误 *******************************************************/#de 阅读全文
posted @ 2014-01-23 16:42 天之涯0204 阅读(309) 评论(0) 推荐(0)
摘要:#include int main(){ /*************************************************** * 枚举:约束一些变量的取值在一个范围,但是C语言枚举是弱类型,本质是int * 类型,可以任意的赋予合适的值,但是使用枚举时,应该遵守枚举对值的 * 约束,这样才可以体现枚举的作用,还有给枚举取一个有意义的名称有益于 * 不同人对枚举的认识。 * 枚举定义格式(类似于结构体) * enum 枚举名称 * { * 枚举常量,之间用逗号隔开... 阅读全文
posted @ 2014-01-23 12:45 天之涯0204 阅读(320) 评论(0) 推荐(0)
摘要:#include int main(){ /*************************************************** *结构体嵌套:结构体里面包含结构体 * *注意:被包含的结构体要先定义,结构体不能包含自己 ****************************************************/ struct Date { int year; int month; int day; }; struct Student {... 阅读全文
posted @ 2014-01-23 12:30 天之涯0204 阅读(390) 评论(0) 推荐(0)
摘要:#include struct Person { char *name; };void change1(struct Person p);void change2(struct Person *p);int main(){ /*************************************************** *结构体和函数 * 1、当结构作为函数的参数时,只是将实参结构体所有成员的值对应地赋值给了 * 形参结构体的所有成员 * 2、当结构体形参是指针时,会影响外面结构体的值 * *注意结构体类型的定义要在函数... 阅读全文
posted @ 2014-01-23 12:23 天之涯0204 阅读(343) 评论(0) 推荐(0)
摘要:#include int main(){ /*************************************************** *结构体指针:指向结构体的指针 * * struct Student * { * char *name; * }; * 1.指向结构体的指针的定义 * struct Student *p; * 2.利用指针访问结构体的成员 * 1> (*p).成员名称 * 2> p->成员名称(针对结构体的特殊方法) ******... 阅读全文
posted @ 2014-01-23 11:55 天之涯0204 阅读(179) 评论(0) 推荐(0)
摘要:#include int main(){ /*************************************************** *结构体数组:数组的每个元素都是结构体类型,注意是同一种结构体类型 * * struct RankRecord * { * int no; * int score; * char *name; * }; * struct RankRecord record[3]; ********************... 阅读全文
posted @ 2014-01-23 11:49 天之涯0204 阅读(264) 评论(0) 推荐(0)
摘要:#include int main(){ /*************************************************** *定义结构体变量的3种方式 * 1、先定义类型,再定义变量(分开定义) * struct Student * { * int age; * }; * struct Student stu; * 2、 定义类型的同时定义变量(stu) * struct Student ... 阅读全文
posted @ 2014-01-23 11:42 天之涯0204 阅读(446) 评论(0) 推荐(0)
摘要:#include int main(){ /*************************************************** * * 结构体内存分析(注意结构体里面定义成员结束后要使用分号): * struct Date * { * int year; * int month; * int day; * }; * struct Student * { * int age; * char sex... 阅读全文
posted @ 2014-01-23 11:18 天之涯0204 阅读(2515) 评论(0) 推荐(0)
摘要:#include int main(){ /*************************************************** * * 数组:由多个相同类型的数据构成 * 结构体:可以由多个不同类型的数据构成 * * 结构体的使用: * 1、定义结构体类型 * struct Person * { * int age; // 年龄 * double height; // 身高 * char *name; ... 阅读全文
posted @ 2014-01-23 10:58 天之涯0204 阅读(157) 评论(0) 推荐(0)
摘要:#include char *test();void test1();int main(){ /********************************************* * 指针函数:返回指针的函数(格式:返回数据类型 * 函数名(参数列表)) * 函数指针:指向函数的指针 * * 定义指向函数的指针 * 格式: 函数返回类型 (*指针变量名)(参数列表) * double (*p)(double, char *, int); * 函数的指针赋值(函数名就是函数的地址): ... 阅读全文
posted @ 2014-01-22 19:54 天之涯0204 阅读(219) 评论(0) 推荐(0)
摘要:#include int main(){ /********************************************* * 内存: * 1.常量区 * 存放一些常量字符串,这些字符串可以缓存,当再次定义相同的字符串时, * 直接可以使用。这样的字符串是不允许修改的 * 2.堆 * 存放对象 * 3.栈 * 存放局部变量 * * 指针和字符串: * 定义字符串的2种方式 * 1> 利用数组 * ... 阅读全文
posted @ 2014-01-22 19:38 天之涯0204 阅读(181) 评论(0) 推荐(0)
摘要:#include int main(){ /********************************************* * * 指针和数组: * 定义数组:数组名就是数组第一个元素的地址 * int ages[5]; * int *p; * p = ages; * 访问数组元素的方法: * 1、数组名[下标] ages[i] * 2、指针变量名[下标] p[i] * 3、*(p + i) * * 指针变... 阅读全文
posted @ 2014-01-22 18:09 天之涯0204 阅读(200) 评论(0) 推荐(0)
摘要:#include int main(){ /********************************************* * * %d int * %f float\double * %ld long * %lld long long * %c char * %s 字符串 * %zd unsigned long * * 清空指针: * int a = 10; * int *p = &a; * //1、 * ... 阅读全文
posted @ 2014-01-22 17:55 天之涯0204 阅读(3109) 评论(0) 推荐(0)
摘要:#include int main(){ /********************************************* * * 指针的长度:不同机器可能不同,但是指针变量的长度都是一样的 * **********************************************/ int a = 10; int *pi = &a; printf("int类型指针的长度:%d\n",sizeof(pi)); double b = 10; double *pd = &b; printf("d... 阅读全文
posted @ 2014-01-22 17:42 天之涯0204 阅读(1075) 评论(0) 推荐(0)
摘要:#include int main(){ /********************************************* * 指向指针的指针:指针变量存储的是指针的地址 * int a = 10; * int *p; * p = &a; * int **pp; * pp = &p; * **********************************************/ int a = 10; int *p; p = &a; int **pp; ... 阅读全文
posted @ 2014-01-22 17:37 天之涯0204 阅读(186) 评论(0) 推荐(0)
摘要:#include int main(){ /*********************************************** * 指针使用注意事项: * 不建议的写法, * 1、int *p只能指向int类型的数据 * int *p; * double d = 10.0; * p = &d; * 2、指针变量只能存储地址 * int *p; * p = 200; * 3、 指针变量未经过初始化,不要拿... 阅读全文
posted @ 2014-01-22 17:19 天之涯0204 阅读(150) 评论(0) 推荐(0)
摘要:#include void change(int *);int main(){ /**************************************************** * 指针: * 格式:变量类型 *变量名; * 指针变量只能存储地址 * 指针就一个作用:能够根据一个地址值,访问对应的存储空间 * int *p; * 指针变量p前面的int:指针变量p只能指向int类型的数据 * *********************************... 阅读全文
posted @ 2014-01-22 17:09 天之涯0204 阅读(132) 评论(0) 推荐(0)
摘要:#include #include int main(){ /************************************************** * 字符串:在内存中是以字符数组的形式存储,最后面有一个\0标示字符串结束 * \0的ASCII码值是0 * 下面的都是字符串 * char name[8] = "it"; * char name2[8] = {'i', 't', '\0'}; * char name3[8] = {'i', 't', 0}; ... 阅读全文
posted @ 2014-01-21 21:00 天之涯0204 阅读(195) 评论(0) 推荐(0)
摘要:#include void printArray(int array[], int length){ for (int i = 0; i<length; i++) { printf("array[%d] = %d \n", i, array[i]); }}void printArrayAddr(int array[]){ printf("array的地址是%p \n", array);}int main(){ /************************************************ * * 使用数... 阅读全文
posted @ 2014-01-21 18:25 天之涯0204 阅读(319) 评论(0) 推荐(0)
摘要:#includeint main(){ //交换两个数的值 // 方法一 可读性最好 int a = 10; int b = 11; int temp ; temp = a; a = b; b = temp; printf("a = %d, b = %d\n",a, b); //方法二 int c = 10; int d = 11; c = d - c; d = d - c; c = d + c; printf("c = %d, d = %d\n",c, d); // 方法三 int e = 10; ... 阅读全文
posted @ 2014-01-21 10:40 天之涯0204 阅读(312) 评论(0) 推荐(0)
摘要:#includeint main(){ /*************************************** * 9的二进制是:b1001 * 5的二进制是:b0101 **************************************/ printf("二进制0b1001是:%d\n",0b1001); printf("二进制0b0101是:%d\n",0b0101); /*************************************** * 按位与运算符:&,两个数字相同位全部为1时,结果位为1 * ... 阅读全文
posted @ 2014-01-21 10:26 天之涯0204 阅读(233) 评论(0) 推荐(0)
摘要:#includeint main(){ int number = 12; float f = 12.0; printf("十进制输出:%d\n", number); printf("十进制输出:%i\n", number); printf("八进制输出:%o\n", number); printf("十六进制输出:%x\n", number); printf("输出地址:%p\n", &number); printf("浮点数输出:%f\n", f); return 阅读全文
posted @ 2014-01-20 20:33 天之涯0204 阅读(842) 评论(0) 推荐(0)
摘要:#includeint main(){ //默认情况下是十进制 int number = 12; // 二进制(0b或者0B开头) int number2 = 0b1100; //八进制(0开头) int number8 = 014; //十六进制(0x或者0X开头) int number16 = 12; printf("%d\n", number); printf("%d\n", number2); printf("%d\n", number8); printf("%d\n", number16); return 阅读全文
posted @ 2014-01-20 20:26 天之涯0204 阅读(2845) 评论(0) 推荐(0)
摘要:#includeint main(){ int size1 = sizeof 10; int size2 = sizeof(10); int a = 10; int size3 = sizeof a; int size4 = sizeof(a); int size5 = sizeof(int); int size7 = sizeof(double); //int size6 = sizeof int;//错误写法 printf("sizeof 10 :%d\n",size1); printf("sizeof(10):%d\n",size2); pri.. 阅读全文
posted @ 2014-01-19 13:12 天之涯0204 阅读(197) 评论(0) 推荐(0)
摘要:#include//int float double short char longint main(){ //int printf(const char *format,[argument]); //format的格式 %[flags][width][.prec][F|N|h|l]type //type的字符用于规定输出数据的类型 //d、i 接受整数值并将它表示为有符号的十进制整数,i是老式写法 int a = 10; printf("%d\n",a); //f float或double 单精度浮点数或双精度浮点数 float f =... 阅读全文
posted @ 2014-01-18 21:35 天之涯0204 阅读(573) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-16 10:41 天之涯0204 阅读(122) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { TabHost tabHost; @Override ... 阅读全文
posted @ 2014-01-16 10:39 天之涯0204 阅读(245) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private ListView listView; private List data = new ArrayList(); ArrayAdapter adapter; View footer; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.... 阅读全文
posted @ 2014-01-16 10:24 天之涯0204 阅读(311) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { ListView listView; File cache; //访问其他线程在当前线程中存放的数据 Handler handler = new Handler(){ public void handleMessage(Message msg) { listView.setAdapter(new ContactAdapter(MainActivity.this, (List)msg.obj, R.lay... 阅读全文
posted @ 2014-01-15 17:07 天之涯0204 阅读(394) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { //声明PopupWindow对象 PopupWindow popupWindow; View parent; private int[] images = {R.drawable.i1,R.drawable.i2,R.drawable.i3,R.drawable.i4, R.drawable.i5,R.drawable.i6,R.drawable.i7,R.drawable.i8}; private String[] names = {"搜索", "文... 阅读全文
posted @ 2014-01-15 14:53 天之涯0204 阅读(519) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //设置窗口特性为自定义标题 requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setCon... 阅读全文
posted @ 2014-01-15 09:48 天之涯0204 阅读(229) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-14 16:20 天之涯0204 阅读(146) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private ImageView imageView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); imageView = (ImageView) this.findViewById(R.id.imageView)... 阅读全文
posted @ 2014-01-14 13:54 天之涯0204 阅读(253) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private ImageView imageView; //传感器管理器 private SensorManager manager; //传感器监听器 private SensorListener listener = new SensorListener(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState... 阅读全文
posted @ 2014-01-13 21:57 天之涯0204 阅读(230) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private ViewFlipper viewFlipper; private float startX; private Animation in_lefttoright; private Animation out_lefttoright; private Animation in_righttoleft; private Animation out_righttoleft; @Override public void onCreate(Bun... 阅读全文
posted @ 2014-01-13 20:46 天之涯0204 阅读(367) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-13 19:39 天之涯0204 阅读(102) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-13 15:03 天之涯0204 阅读(167) 评论(0) 推荐(0)
摘要://通知图标 int icon = android.R.drawable.stat_notify_chat; //创建通知对象,icon通知图标,tickerText摘要,System.currentTimeMillis()通知时间 Notification notification = new Notification(icon, tickerText, System.currentTimeMillis()); Intent intent = new Intent(Intent.ACTION_CALL, Uri.pars... 阅读全文
posted @ 2014-01-13 14:22 天之涯0204 阅读(364) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-12 22:06 天之涯0204 阅读(122) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-12 21:37 天之涯0204 阅读(94) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-12 21:22 天之涯0204 阅读(84) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private static final String TAG = "MainActivity"; private GestureLibrary library; private Gesture mgesture; private GestureOverlayView overlayView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedIn... 阅读全文
posted @ 2014-01-12 19:23 天之涯0204 阅读(330) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private SurfaceView surfaceView; private RelativeLayout layout; private Button recordbutton; private Button stopbutton; private MediaRecorder mediaRecorder; @Override public void onCreate(Bundle savedInstanceState) { super.... 阅读全文
posted @ 2014-01-12 17:08 天之涯0204 阅读(216) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private View layout; private Camera camera; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE);//设置Activity没有标题 getWindow().set... 阅读全文
posted @ 2014-01-12 16:31 天之涯0204 阅读(189) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private EditText nameText; private String path; private MediaPlayer mediaPlayer; private SurfaceView surfaceView;//此组件用于播放视频 private boolean pause; private int position; @Override public void onCreate(Bundle savedInstanceState)... 阅读全文
posted @ 2014-01-12 15:35 天之涯0204 阅读(235) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private EditText nameText; private String path; private MediaPlayer mediaPlayer; private boolean pause; private int position; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... 阅读全文
posted @ 2014-01-12 12:26 天之涯0204 阅读(210) 评论(0) 推荐(0)
摘要:远程端:package cn.itcast.aidl;//AIDL//首先建立AIDL文件,有点和接口类似,建立好AIDL文件后,//会在gen文件夹下自动生成用于远程通信的类//文件的后缀为aidlinterface StudentQuery { String queryStudent(int number);}自动生成的用于远程通信的类(gen文件夹下)package cn.itcast.aidl;//AIDLpublic interface StudentQuery extends android.os.IInterface{/** Local-side IPC implement... 阅读全文
posted @ 2014-01-12 11:38 天之涯0204 阅读(310) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private EditText studentno; private ServiceConnection conn = new StudentServiceConnection(); private IStundent iStundent; private TextView resultView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(save... 阅读全文
posted @ 2014-01-11 21:20 天之涯0204 阅读(721) 评论(0) 推荐(0)
摘要:public class PhoneService extends Service { @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } @Override public void onCreate() { super.onCreate(); TelephonyManager telephonyManager = (TelephonyManager) getSys... 阅读全文
posted @ 2014-01-11 21:18 天之涯0204 阅读(330) 评论(0) 推荐(0)
摘要:/** * 采用FTP上传文件 */public class FTPUpload { Socket socket = null; BufferedReader reader = null; BufferedWriter writer = null; public synchronized void connect(String host) throws IOException { connect(host, 21); } public synchronized void connect(String host, int port) th... 阅读全文
posted @ 2014-01-11 20:20 天之涯0204 阅读(843) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-11 17:43 天之涯0204 阅读(127) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-11 16:03 天之涯0204 阅读(126) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-11 12:54 天之涯0204 阅读(135) 评论(0) 推荐(0)
摘要:Activity是系统组件,所以每个Activity都要在清单文件中进行配置。 阅读全文
posted @ 2014-01-11 11:35 天之涯0204 阅读(139) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public void openActivity(View v){ //... 阅读全文
posted @ 2014-01-10 21:32 天之涯0204 阅读(318) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private EditText pathText; private TextView resultView; private Button downloadButton; private Button stopbutton; private ProgressBar progressBar; //hanlder的作用是用于往创建Hander对象所在的线程所绑定的消息队列发送消息 private Handler handler = new UIHander(); ... 阅读全文
posted @ 2014-01-10 16:54 天之涯0204 阅读(184) 评论(0) 推荐(0)
摘要:public class MulThreadDownloader { public static void main(String[] args) throws Exception { String path = "http://192.168.1.100:8080/web/QQWubiSetup.exe"; int threadsize = 3; new MulThreadDownloader().download(path, threadsize); } private void download(String path, int... 阅读全文
posted @ 2014-01-10 11:55 天之涯0204 阅读(296) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-10 11:03 天之涯0204 阅读(137) 评论(0) 推荐(0)
摘要:/** * 通过HttpClient发送Post请求 * @param path 请求路径 * @param params 请求参数 * @param encoding 编码 * @return 请求是否成功 */ private static boolean sendHttpClientPOSTRequest(String path, Map params, String encoding) throws Exception{ List pairs = new ArrayList();//存放请求参数 if(p... 阅读全文
posted @ 2014-01-09 16:26 天之涯0204 阅读(908) 评论(0) 推荐(0)
摘要:public class MainActivity extends Activity { private EditText pathText; private ImageView imageView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); pathText = (EditText) this.... 阅读全文
posted @ 2014-01-08 21:13 天之涯0204 阅读(223) 评论(0) 推荐(0)
摘要:内容提供者对外提供共享数据,需要在清单文件中进行配置,必须在应用的包或者子包下。ContentProvider类public class PersonProvider extends ContentProvider //必须继承ContentProvider类{ private DBOpenHelper dbOpenHelper; private static final UriMatcher MATCHER = new UriMatcher(UriMatcher.NO_MATCH); private static final int PERSONS = 1; pr... 阅读全文
posted @ 2014-01-08 13:05 天之涯0204 阅读(346) 评论(0) 推荐(0)
摘要:item.xml MainActivity.javapublic class MainActivity extends Activity { private ListView listView; private PersonService personService; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ... 阅读全文
posted @ 2014-01-07 19:31 天之涯0204 阅读(470) 评论(0) 推荐(0)
摘要:// 通过SQLiteOpenHelper调用如下方法时会返回SQLiteDatabase,通过SQLiteDatabase可以对数据库进行操作getWritableDatabase()getReadableDatabase()public class PersonService { private DBOpenHelper dbOpenHelper; public PersonService(Context context) { this.dbOpenHelper = new DBOpenHelper(context); } public v... 阅读全文
posted @ 2014-01-06 19:43 天之涯0204 阅读(421) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-06 12:52 天之涯0204 阅读(152) 评论(0) 推荐(0)
摘要:person.xml liming 30 zhangxiaoxiao 25 public class PersonService { /** * 获取数据 * @param xml * @return * @throws Exception */ public static List getPersons(InputStream xml) throws Exception{ List persons = null; Person ... 阅读全文
posted @ 2014-01-05 21:16 天之涯0204 阅读(223) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-05 19:36 天之涯0204 阅读(137) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-05 19:14 天之涯0204 阅读(108) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-05 19:13 天之涯0204 阅读(91) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-05 12:14 天之涯0204 阅读(106) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-05 11:34 天之涯0204 阅读(90) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-04 21:43 天之涯0204 阅读(110) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-04 21:42 天之涯0204 阅读(117) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2014-01-04 20:41 天之涯0204 阅读(136) 评论(0) 推荐(0)
摘要:User.xml insert into User ( name, password ) values (#userName#,#password#) update ACCOUNT set ACC_FIRST_NAME = #firstName#, ACC_LAST_NAME = #lastName#, ACC_EMAIL = #emailAddress# where ACC_ID = #id# --> delete f... 阅读全文
posted @ 2014-01-02 11:21 天之涯0204 阅读(400) 评论(0) 推荐(0)