部分接口和类的学习
来源:互联网 发布:淘宝刚开店怎么运营 编辑:程序博客网 时间:2024/05/01 00:45
1、Handler的基本概念
A Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue.
Handler handler = new Handler();
handler.post(updateThread);//调用Handler的post方法,将要执行的线程对象条件到队列当中;
将要执行的操作写在线程对象的run方法中
Runable updateThread = new Runable();
{
public run(){
handler.postDelayed();
postDelayed(Runable r,long uptimeMillis)
Causes the Runnable to be added to the message queue ,to be run after the specified amount of time elapses.
}
}
Activity 处在一个线程中,自己的处理放在另一个线程中。
Handler updateBaHandler = new Handler(){
// Message : Defines a message containing a description and arbitrary data object that can be sent to a Handler.
// arg1 arg1 and arg2 are lower-cost alternatives to using setData() if you only need to store a few integer values.
public void handleMessage(Message msg){
bar.setProgress(msg.arg1);
updateBaHandler.post(updateThread);
}
};
//线程类,该类使用匿名内部类的方式进行生命
Runnable updateThread = new Runnable() {
int i = 0 ;
public void run() {
System.out.println("Begin Thread");
//得到一个消息对象,Message类是有Andoroid操作系统提供
i = i + 10;
Message msg = updateBaHandler.obtainMessage();//得到message对象
//将msg对象的arg1参数的值设置为i,用agr1和agr2系统优化
msg.arg1 = i;
try{
Thread.sleep(1000);
}catch(InterruptedException e){
e.printStackTrace();
}
updateBaHandler.sendMessage(msg);
if(i == 100){
updateBaHandler.removeCallbacks(updateThread);
}
//handler.postDelayed(updateThread, 3000);
}
};
2、android.database.Cursor is a interface ,this interface provides random read-write access to the result set returned by a database query .
Cursor implementations
are not required to be synchronized ;
3、android.context.ContextValues ,the class is used to stroe a set of values that ContextResolver(内容解析器) can process
4、parcelable is a interface ,interface for classes whose instances can be written to and restored from a Parcel .Classes implementing
the Parcelable interface must alseo have a static field called creator ,which is an object implementing the Parcelable.Creator interface;
5、android.util.Log API for sending log output .realistically ,there is also another buffer allocation and copy ,and even more pressure on the
gc.That means that if your log message is filtered out,you might be doing significant work and incurring significant overhead .(做重大的工作和承担重大的开销)
6、HttpInterface for an HTTP client.
- 部分接口和类的学习
- SIP部分类和接口的使用
- 抽象类和接口的部分小节
- 【笔试】接口和抽象类的部分区别
- Java抽象类和接口的学习
- 抽象类和接口的学习
- 学习Java的接口和抽象类
- Java抽象类和接口的学习
- 抽象类和接口的学习
- 接口的部分理解
- ARM第一部分-CPU和外部存储器的接口
- servlet的部分作用域和接口简介
- 抽象类和接口的相同点和不同点,学习笔记
- swift的部分代码概述和学习
- 学习接口和抽象类
- C#Interface 接口、接口的特点、接口的用法、多态性、部分类、密封类、ToString()重载
- 部分的开发文档接口
- java普通类、抽象类和接口的再学习
- 计算机爱好者 VS. 程序员
- 泄露你的JavaScript技术很烂的五个表现
- [摘抄]1937年西方人拍电影反映中国生活《大地》
- 云计算势必会有广泛的应用
- nand flash坏块管理OOB,BBT,ECC
- 部分接口和类的学习
- AutoCAD .NET API基础(三) 集合对象
- Silverlight 初始页面定位焦点
- 关联容器
- AutoCAD .NET API基础(四) 了解属性和方法
- [摘抄]1937年美国电影《大地》
- AutoCAD .NET API基础(五) 进程外与进程内
- 数据结构笔记2
- axis1.4 返回数组,出现异常- Java / Java EE 最终解决办法