上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页
摘要: 在Windows里启动一个程序就是启动一个线程。不同线程之间快速切换,所以感觉是很多线程在同时执行。 Test.java 阅读全文
posted @ 2014-01-11 21:17 LarryLawrence 阅读(401) 评论(0) 推荐(0) 编辑
摘要: MARS老师说,见到重复代码就要想方设法去掉它!我也常常是这样想的,但水平有限,常常有心无力啊。。这次可能是第一次实现。 如图,services包里有两个用到Upload函数的类,以前的话我是直接把Upload函数复制到这两个类里面,实现了就行了嘛。这次决定把这个方法提出来,封装到UploadUtils.java里面。//原本是这样的: public void uploadFile() { String srcPath = Environment.getExternalStorageDirectory().getPath()+ "/" + “a.txt”;....}uplo 阅读全文
posted @ 2014-01-05 18:56 LarryLawrence 阅读(398) 评论(0) 推荐(0) 编辑
摘要: switch可以替代if..else..,另外据说switch采用二分搜索,效率会更高一点。switch(type) { case 1 : type_name="INCOMING";break;//break! case 2 : type_name="OUTGOING";break; case 3 : type_name="MISSED";break; }注意如果没有break,type_name总会被赋值为"MISSED"..参考:http://www.blogjava.net/Sunday/archive/20 阅读全文
posted @ 2014-01-04 19:47 LarryLawrence 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 下面是代码,不过没有字母表的顺序排列:package com.example.getcontacts;import java.io.FileWriter;import java.io.IOException;import java.io.InputStream;import java.util.ArrayList;import android.app.Activity;import android.content.ContentResolver;import android.content.ContentUris;import android.content.Context;import an 阅读全文
posted @ 2013-12-05 21:45 LarryLawrence 阅读(322) 评论(0) 推荐(0) 编辑
摘要: ArrayList是所谓的动态数组。用一个小例子:import java.util.ArrayList;import java.util.Iterator;import java.util.List;class arraylist{ public static void main(String args[]) { List list = new ArrayList(); list.add("zhoushiwen"); list.add("comes again today!"); list.add("i am so neverous!" 阅读全文
posted @ 2013-12-05 20:47 LarryLawrence 阅读(208) 评论(0) 推荐(0) 编辑
摘要: reference的overview是:A mapping from String values to various Parcelable types.1.看了一篇文章(http://blog.csdn.net/randyjiawenjie/article/details/6651437),了解到它可以存储键值对:Bundle mBundle = new Bundle(); mBundle.putString("Data", "data from TestBundle"); //传值给另一个Activity:Intent intent = new In 阅读全文
posted @ 2013-12-02 21:21 LarryLawrence 阅读(300) 评论(0) 推荐(0) 编辑
摘要: java.io中有四个重要的抽象类:InputStream(字节输入流)Reader(字符输入流)OutputStream(字节输出流)Writer(字符输出流)其中,InputStream和Reader为子类提供read()方法,OutputStream和Writer为子类提供write()方法。1.文件字节流:包含FileInputStream类和FileOutputStream类。2.文件字符流:包含FileReader和FileWriter。3.缓冲流:包含BufferedReader和BufferedWriter。4.数组流:ByteArrayInputStream和ByteArra 阅读全文
posted @ 2013-12-01 19:58 LarryLawrence 阅读(387) 评论(0) 推荐(0) 编辑
摘要: ① 完全匹配 /test/list.do② 路径匹配 /* struts2匹配根路径下的全部请求③ 扩展名匹配 *.do struts1 *.html 匹配全部html结尾的请求 * 不能用*,否则报错————————————————————————————发现是,在1中,如果你把http://localhost:8080/book/HelloWorld.do写成http://localhost:8080/book/jb/HelloWorld.do(加了一层/jb),而相应的/*改成/jb/*,也是可以访问的。How amazing. 阅读全文
posted @ 2013-11-20 21:46 LarryLawrence 阅读(453) 评论(0) 推荐(0) 编辑
摘要: 碰到了android无法识别string的问题Cursor cursor = db.query(true, "user", new String[]{"id","mode","checked"}, "id=?", new String[]{"1"}, null, null, "1,2", null); cursor.moveToNext(); String mode = cursor.getString(cursor.getColumnIndex(&quo 阅读全文
posted @ 2013-11-19 17:54 LarryLawrence 阅读(346) 评论(0) 推荐(0) 编辑
摘要: 用Intent启动另一个Activity的方法: private void showSettings() { final Intent intent = new Intent(this,SettingsActivity.class); startActivity(intent); } 调用showSettings函数即可启用SettingsActivity。另外,广播是不需要intent来启动的。直接在BroadcastReceiver里面用getAction()函数来接收广播就行了(不要忘了注册),别的Activity里面不用写任何东西。比... 阅读全文
posted @ 2013-11-18 20:17 LarryLawrence 阅读(184) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页