摘要: HTTp协议的请求格式1.RequestLine GET/day02/load.jsp HTTP/1.12.若干消息头 Header用于告诉服务端,客户端的状态及客户端传递的请求参数的状态。key:value3.请求实体 Entity 存储post请求时给服务端传递的参数 响应数据包:1 statu 阅读全文
posted @ 2016-03-06 17:41 gentspy 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 群聊天室服务端:准备在线Socket列表:list<Socket>sockets;ServerSocket ss; while(ture){Socket s=ss.accept();sockets.add(s);new WorkThread(s).start();}WorkThread{for(in 阅读全文
posted @ 2016-03-06 17:40 gentspy 阅读(187) 评论(0) 推荐(0) 编辑
摘要: socket服务端处理多个客户端的请求:while(true){Socket s=ss.accept();new WorkThread(s).start();}class WorkThread edtends Thread{private Socket s;public WorkThread(Soc 阅读全文
posted @ 2016-03-06 17:39 gentspy 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 第一:重用convertView,public ViewgetView(int position,ViewconvertView,ViewGroup parent){if(convertView==null){convertVie=layoutInflate.form().inflate();}Te 阅读全文
posted @ 2016-03-05 13:58 gentspy 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1 Strong Referenceeg: Emp e=new Emp(); 2.soft Reference eg: softReference ref=new SoftReference(bitmap); HashMap<String,SoftReference<Bitmap>> cache=n 阅读全文
posted @ 2016-03-04 21:08 gentspy 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 内存缓存:存 HashMap<String,Bitmap>cache;Bitmap bitmap;cache.put(path,bitmap)取:cache.get(path) weakedHashMap<String,xx>map;while(true){map.put(xx,xx); 文件缓存: 阅读全文
posted @ 2016-03-04 20:50 gentspy 阅读(169) 评论(0) 推荐(0) 编辑
摘要: AsyncTask是集成了后台执行任务,更新进度,处理结果的工具,开发者在使用时无需关注子线程与主线程通信的问题。public class HandlerActivity extends Activity {....private class UpdataProgress Threasd exten 阅读全文
posted @ 2016-03-03 18:13 gentspy 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Message, 为了进程之间的通信,如主线程和工作线程, ..... Message .....private class InnerHandler extends Handler{@overridepublic void handleMessage(Message msg){if(msg.wha 阅读全文
posted @ 2016-03-02 22:54 gentspy 阅读(411) 评论(0) 推荐(0) 编辑
摘要: THREAD'S 安全synchronized(){if(account.amount>=800){System.out.println(name+"检查到与额为:“+account.amout+"!")}else{System.out.println(name+"检查到与额不足,取钱失败!);}} 阅读全文
posted @ 2016-03-02 22:23 gentspy 阅读(157) 评论(0) 推荐(0) 编辑
摘要: *广播发送方调用 sendBrodcast(Intent intent),该方法是由ContextWrapper定义的*广播接受方调用BroadcastReceiver来实现,广播的动态注册,调用registerReceiver(BroadcastReceiver reciver, IntentFi 阅读全文
posted @ 2016-03-02 22:07 gentspy 阅读(241) 评论(0) 推荐(0) 编辑