03 2016 档案
摘要:public class PlanView extends View{ public float currentX; public float currenty; Bitmap plan; public PlanView(Context context) { super(context); plan
阅读全文
摘要:用线程 public class Test extends Activity {private final int SPLASH_DISPLAY_LENGHT = 10000; // 延迟10秒@Overridepublic void onCreate(Bundle savedInstanceSta
阅读全文
摘要:ImageButton 是带图标的Button控件,有src的属性,也就是设置他的图标,也有一个所有控件公有的属性background, 这个也可以设置它的“图标”。 其实,src才是设置图标,而background只是设置背景。 如果控件的大小是100*100 图片资源是80*80的话,那么用sr
阅读全文
摘要:when your AS show this infro: Error running app:Instant Run requires 'Tools|Android|Enable ADB integration' to be enable a Method is: 菜单栏,Tools -> Adn
阅读全文
摘要:景演示 : 切换到该Fragment 11-29 14:26:35.095: D/AppListFragment(7649): onAttach11-29 14:26:35.095: D/AppListFragment(7649): onCreate11-29 14:26:35.095: D/App
阅读全文
摘要:有人喜欢问点毫无关系的问题,EG:override&overload final&finallize&finally 他们没有关系,override是一个类继承super class 而为了配合自己的业务,override 父类的方法。 overload是同一个类中包括同名的,参数个数不同,类型不同
阅读全文
摘要:1,首先要申明广播private BroadCastReceiver mBroadcastReceiver=new BroadcastReciver(){public void onReceive(Context context,Intent intent//onReceive不能做好事操作){Lo
阅读全文
摘要:使用场景1,通过startService开启的服务,一旦服务开启,这个服务和开启他的调用者之间就没有任何关系了,调用者不可以访问Service里面的方法,调用者被系统回收或调用了onDestroy方法,Service还会继续存在2,通过bindService开启服务,Service和调用者之间还存在
阅读全文
摘要:onCreate()>onstart()>onDestroy()startService(Intent intent);public boolean bindService(Intent intent,ServiceConnection conn;int flags);*MainActivity..
阅读全文
摘要:*Property AnimationObjectAnimator anim=ObjectAnimator.ofFloat((textView, "asdfasdf", 0F, 1F);anim.setDuration(2000);anim.addUpdateListener(new Animato
阅读全文
摘要:AppWidget1.声明AppWIdget的布局文件。2.声明AppWidget的元数据文件3,声明Appwidget的控制器,该类继承子AppWidgetProvider4.在manefast文件中注册<receiver android:name=“com.example.android_day
阅读全文
摘要:1.构建PendingIntent Intent intent=new Intent(context,Activity.class); PendingIntent pendingIntent=PendingIntent.getActivity(intent); 2.给Notification对象设置
阅读全文
摘要:1,如何获取notifycation NotificationManager manager=context.getSystemService(NOTIFICATION_SERVICE);2.构建notification实例Notification.Builder().setxxx().setxxx
阅读全文
摘要:音乐播放器网络版的客户端:客户端:com.tarena.musicClientactivity 存放ActivityMainActiivtyonCreate(){//加载音乐列表new MusicBiz().execute();}biz 存放业务类MusicBiz extends AsyncTask
阅读全文
摘要:JSONArray//JSON数组String str=[{"name":"zs"},"hello",true,["c","h"]];JSONArray ary=new JSONArray(str);ary.length();ary.getJSONObject(0).getString("name"
阅读全文
摘要:JSON 轻量级的数据交换语言JSON:{“name”:“zs”,"age":20,"gender":"m","aihao":["0","a","."],"married":false,"school":{”name":"tarena","loc":"bj"}}; String str={“name
阅读全文
摘要:GET与POST请求方法1.请求参数的存放位置 GET:请求资源路径后拼接 POST:存放在请求实体2.安全性3,是否适合传递中文GET: 不适合POST:较适合4,是否适合大数据提交 POST:适合 *发送GET请求//创建HttpClient对象HttpClient client=new Def
阅读全文
摘要:Android中Context的学习理解Context是一个抽象基类,通过它getResuources.getAssets and start 其他组件(Activity,Service,broadCast,getSystemService),可以这样理解:Context提供了一个运行环境for A
阅读全文
摘要:HTTp协议的请求格式1.RequestLine GET/day02/load.jsp HTTP/1.12.若干消息头 Header用于告诉服务端,客户端的状态及客户端传递的请求参数的状态。key:value3.请求实体 Entity 存储post请求时给服务端传递的参数 响应数据包:1 statu
阅读全文
摘要:群聊天室服务端:准备在线Socket列表:list<Socket>sockets;ServerSocket ss; while(ture){Socket s=ss.accept();sockets.add(s);new WorkThread(s).start();}WorkThread{for(in
阅读全文
摘要:socket服务端处理多个客户端的请求:while(true){Socket s=ss.accept();new WorkThread(s).start();}class WorkThread edtends Thread{private Socket s;public WorkThread(Soc
阅读全文
摘要:第一:重用convertView,public ViewgetView(int position,ViewconvertView,ViewGroup parent){if(convertView==null){convertVie=layoutInflate.form().inflate();}Te
阅读全文
摘要:1 Strong Referenceeg: Emp e=new Emp(); 2.soft Reference eg: softReference ref=new SoftReference(bitmap); HashMap<String,SoftReference<Bitmap>> cache=n
阅读全文
摘要:内存缓存:存 HashMap<String,Bitmap>cache;Bitmap bitmap;cache.put(path,bitmap)取:cache.get(path) weakedHashMap<String,xx>map;while(true){map.put(xx,xx); 文件缓存:
阅读全文
摘要:AsyncTask是集成了后台执行任务,更新进度,处理结果的工具,开发者在使用时无需关注子线程与主线程通信的问题。public class HandlerActivity extends Activity {....private class UpdataProgress Threasd exten
阅读全文
摘要:Message, 为了进程之间的通信,如主线程和工作线程, ..... Message .....private class InnerHandler extends Handler{@overridepublic void handleMessage(Message msg){if(msg.wha
阅读全文
摘要:THREAD'S 安全synchronized(){if(account.amount>=800){System.out.println(name+"检查到与额为:“+account.amout+"!")}else{System.out.println(name+"检查到与额不足,取钱失败!);}}
阅读全文
摘要:*广播发送方调用 sendBrodcast(Intent intent),该方法是由ContextWrapper定义的*广播接受方调用BroadcastReceiver来实现,广播的动态注册,调用registerReceiver(BroadcastReceiver reciver, IntentFi
阅读全文
摘要:通过BitmapFactory的decode系列方法可以将其位置的图片加载为bitmap的对象, //todo
阅读全文
摘要:创建SQLite:String sql="CREATE TABLE'student' ("+"_id integer primary key autoincrement, "+"stu_name varchar(16) not null,"+"stu_phone_number varchar(16)
阅读全文
摘要:bindservice Eg:service 和Activity的绑定*定义Service,重写onBind()方法,注:返回值不为null,该返回值类型是IBInder,*在其他组件中,调用bindService()绑定到Service, //todo
阅读全文
摘要:存储方案:偏好设置、文件存储、XML存储、数据库存储【偏好设置】偏好设置是用户在使用软件的过程中,配置的个性化设置,这些设置往往只需要1个值就可以表现。偏好设置适用于保存少量的数据。通过ContextWrapper的getSharedPreferences()方法,可以获取SharedPrefere
阅读全文
摘要:super关键词1访问父类被隐藏的属性public class Parent(){int money=10000;} public class Child extends Parent(){int money=100;pulbic int getParentMoney(){return super.
阅读全文
摘要:android 中的屏幕适配的理解解决屏幕适配的方案:*双面板布局,*少用absolutelyLayout*使用wrap_content,match_parent来控制组件的宽度和高度。 频幕的适配方法1.尽量使用相对布局使用layout_weight方法2.清单文件配置:在AndroidManif
阅读全文
摘要:Java code ? 1 2 3 4 5 6 7 8 /** * @see java.lang.String#valueOf(java.lang.Object) * @see #append(java.lang.String) */ public synchronized StringBuffer
阅读全文

浙公网安备 33010602011771号