2011年6月9日 星期四

Android的四大天王

Activity , Content Provider , Service , broadcast receiver





Content Provider 跟Content Resolver 相對應


Service可以透過三個方法來使用
1. extend the Binder class
可以自行定義之間的interface
2. Messenger
較為方便, 但為single thread
3. AIDL
較麻煩

2011年1月9日 星期日

英文文法考前筆記



1. S + 建議 命令 + that + S + (should) + 原形動詞
要求 規定

p.s. 這邊用should應該不是問題 , 重點是可以省略 , 省略後還是原形動詞


2. 推測語氣
s + must + have + p.p.
may
EX. She must have passed the test yesterday ........

3. Although 的倒裝
Although (=Though) he is a clever boy .....
= Clever boy though (=as) he is ........

4.
Not only + A + but (also) + B | + 與B一致的動詞
Not only + A + but + B + as well |
B + as well as + A |
Either A + or + B |
Neither A + or + B |


5.
A + with + B + 與A一致的動詞
along with
together with

6. When + S1 + 過去式 , S2 + was(were) + V-ing
= While + S2 + was(were) + V-ing , S1 + 過去式

when是配過去式 , while 是配過去進行式

7. 假設語氣 與事實相反

If + S + were ...... , S + would + 原形動詞
動詞過去式 should
助動詞過去式 could

If + S + had + p.p .... , S + would + have + p.p
should
could

8. 希望 與事實相反

與現在事實相反
S + wish + (that) + S + were
動詞過去式
助動詞過去式

與過去事實相反
S + wish + (that) + S + had + p.p

S + wish + S + would + 原形動詞 + 未來時間副詞
should
could

9.
All that you have to do is + (to) 原型動詞
EX : (to) wait patiently
這邊要注意to 可以省略

10.
S + do + nothing but + 原形動詞
S + enjoy + nothing but + V-ing
S + want + nothing but + to + 原形動詞

這邊除了do以外 , enjoy 或want就是看原本沒有 nothing but的情況下 ,後面要接什麼

11.
On + V-ing , S + V
N
= As soon as S + V , S + V
EX: On hearing the news , Jack burst into tears


12
In + V-ing , S + V
= When S + V , S + V
Ex: In preparing for an examination , observe the common sense rules of helth

13.
far from V-ing
EX: He is far from being rich

14.
The book is worth reading
= The book is worthy of being read.
= The book is worthy to be read.
= It's worth your while to read the book
= It's worth while reading the book.

15
It is no use + V-ing
= It is useless to V


2011年1月3日 星期一

C++考前筆記

1.
explicit 是用來防止constructor自動隱含對單一的參數呼叫constructor

Ball(const char*); //這是constructor

Ball ball = "Green ball"; //會讓這行自動成立

2

C考前筆記

1.
&& 或 || 是會先check前面的判斷式 , 若成立 , 才會再check 下一個判斷式
而& 或 | 是會判斷所有的判斷式 , 然後再作and 或 or


2.
在c語言中 , static function代表private的意味 , 其他.c檔無法call這個function


3.
function pointer

利用typedef 來宣告 function pointer , 用起來比較方便
typedef int (*CustomOperator)( int );

//void custom_for_each( int *pArray, unsigned int size, int (*op)( int ) )
void custom_for_each( int *pArray, unsigned int size, CustomOperator op )

2009年10月10日 星期六

GObject

通常會有三個structure

Example

ExampleClass
含public method

ExamplePrivate

2009年9月24日 星期四

重回C++筆記

原來for迴圈如果宣告int i
這個i是local的 , 不會有重複宣告的問題

如果class A有個constructor可接受int
則int 到 A會有一個個implicit的cast

reference只能initial時指定其指的地方

constructor最好使用初始列來initial

為多形而設計的父類別應該要將destructor設為virtual

destructor不應該丟出異常

constructor或destructor內不能呼叫virtual函式
因為此時子類別中的function還沒成形

2009年3月28日 星期六

NotePad Tutorial

跟自己想像中的不同,不是讀取檔案,而是資料庫
之前沒有使用資料庫的經驗,這次剛好體驗一下Android支援的SQLite
資料庫的處理主要使用SQLiteDatabase 跟 SQLiteOpenHelper兩個class

另外在LifeCycle的處理上,這個tutorial也有不錯的處理
只是作完,還是對List跟資料庫之間利用Adapter的轉換沒啥概念