需要完善的笔记

ProgressBar、ListView控件
<ProgressBar
 style="?android:attr/progressBarStyleHorizontal"/>
<ProgressBar
 style="?android:attr/progressBarStyle"/>

ListView 当鼠标被点中的时候会有事件处理——播放音乐

五、Activity的生命周期
public class Activity extends ApplicationContext {
 //第一次被调用的时候使用的方法(第一)
 protected void onCreate(Bundle savedInstanceState);
 
 //第一次启动Activity的时候调用(第二)
 protected void onStart();
 
 //第一次启动获取用户焦点的时候调用下面的方法
 protected void onRestart();
 
 //获得用户的焦点(第三)
 protected void onResume();
 
 //用户启动另一个Activity的时候,会调用第一个Activity的onPauser()方法
 //当Activity切换的时候可以保存数据
 protected void onPause();
 
 //当前一个窗口被完全遮盖的时候调用该方法
 protected void onStop();
 
 //调用一个Activity的finish()方法,或者是操作系统的内存不够用的时候就会使用下面的方法
 protected void onDestroy();
}


什么是Task?

Task is a stack of activities.

如果点击back按钮,当前的activity就会从栈中弹出,显示的是当前Activity的前一个activity


 

七、Handler的使用方法

把处理较大数据量的交给单独的线程处理

一般在耗时比较长的程序中就用Handler

1、先创建一个Handle对象

2、调用Handle的post()方法,将要执行的线程对象添加到队列当中

3、将要执行的操作写在线程对象的run()方法当中

4、在run方法内部执行postDelayed或者post方法

Handler handler = new Handler();

handler.post(thread);

handler.removeCallbacks(thread);

handler.postDelayed(thread, 2000);

handler执行并没有单独新开一个线程,就像Thread没有调用start()方法

数据存储工具——Bundle(String -- Object)

HandlerThread 循环处理消息队列的功能


如果你的onDelete、onUpdate等事件没有触发,那么一个重要的原因是,你override了onReceive事件,但是又没有调用super.onReceive(),所以导致这之后的事件都不会触发,AppWidgetProvider的事件处理机制是,onRecieve首先触发,然后由onReceive去触发后续事件。

猜你喜欢

转载自hbiao68.iteye.com/blog/1317167