搜尋此網誌

2012年4月27日 星期五

新竹市金山街套房出租

金山街舒適大套房出租,有瓦斯鍋爐, 室內晒衣場, 機車停車場,電視,網路,第四台,
專人清潔公共空間,倒垃圾,代收郵件,
月租金6500,
意者洽:03-5632658, 吳先生

另有安康社區(近光復路商圈,生活機能便利)套房出租,一般住宅區,很安靜,家電配備齊全,
租金6000,意者洽,0920-238-669,田先生.

此為版主代友發文

2012年4月26日 星期四

Android-activity筆記

Activity,
1.可以視為應用程式的活動空間, 相當於main method.
2.採用Last in, first out 的back stack機制. 也就是說使用者目前的應用程式放在最上方,暫時沒用到的程式會放在堆疊的下方.

Activity的三種狀態:

Resumed :可恢復的,可想像成使用者正在操作執行中的意思.
Paused: 暫停的,雖然還在前景,可以給使用者看到,但使用者目前並沒有在操作.
Stopped: Activity被放到背景,使用者看不到,雖然還是處於活著的狀態,但當作業系統需要記憶體時,隨時有可能被回收掉.

參考網頁

Android 專有名詞縮寫整理

AVD = Android virtual devices ; android虛擬裝置.
ADT = Android Development Tools; 也就是所謂的sdk,用來開發在android手機上的應用程式.
APK = Application package file.
DEX = Android 的 byte code的附檔名. class是Java byte code的附檔名 DIP = Density-independent pixel , 相對應的單位為dp. 因此android建議在定義圖片像素時要以dp為單位 DPI = dots per inch, 用來形容screen像素在每一inch的點數, 也就是螢幕解析度.

2012年4月14日 星期六

取消Eclipse Syntax Validation(參數驗證)

Windows-->Preferences-->Validations
You can deselect all entries that you don't want to validate.

2012年4月9日 星期一

Java 靜態初始化區塊(Static initialization block)

When you want to initialize a static or instance variable in a more complicated way, you can use block to achieve this goal.
public class StaticInitBlockDemo {

static double[] arra = null;
static {
int size = 5;
array = new double[size];
for (int i = 0; i < array.length; i++) {
array[i] = Math.random();
}
}

public static void main(String[] args){
for(int i =0 ;i<array.length;i++ ){
System.out.println(array[i]);
}
}
}


Static Variable

2012年4月2日 星期一

Design pattern - Java creation method


public class CreationMethod {

public static void main(String [] args){
Student s1 = Student.createInstance(1);
Student s2 = Student.createInstance(1, "hello");
System.out.println(s1.toString());
System.out.println(s2.toString());
}
}

class Student{
int id;
String name;
private Student(int id){
this.id = id;
}

private Student(int id, String name){
this.id = id;
this.name = name;
}

public static Student createInstance(int id , String name){
return new Student(id,name);
}

public static Student createInstance(int id){
return new Student(id);
}

public String toString(){
return id+": "+name;
}
}