2009年12月23日 星期三
HTC Hero變成無線AP(免刷機)
1.Instant Root Instant Root 下載點
2.Wireless Tether wireless tether 下載點
步驟一 : 先裝Instant Root
步驟二 : 再裝Wireless Tether
然後就開啟Wireless Tether來用啦.......
國外網站有說安裝了Instant Root就不要再安裝官方的更新檔,反正到時候hero有釋放Android 2.1時,再把Instant Root移掉就好了!!!!
Instant 移除的方法
You can undo the changes made by this app by installing and opening a terminal emulator (there are several on the market) and typing the following:
su
mount -o remount,rw /dev/block/mtdblock3 /system
rm /system/bin/su
rm /system/xbin/su
rmdir /system/xbin
mount -o remount,ro /dev/block/mtdblock3 /system
exit
exit
後記:
用了大半個月之後突然間Wireless Tether開不起來了......慘.......
所以我最後還是刷機了.....
2009年9月6日 星期日
動態Spinner來變更Image
- 取得res/drawable資料夾下的所有檔案名稱
- 由檔案名稱取得ResourceID
- 點選並顯示圖檔
在Android程式中取得圖檔方法
public Field getDeclaredField (String name)
Returns a Field
object for the field with the specified name which is declared in the class represente by this Class
.
Parameters
name | the name of the requested field. |
---|
Returns
- the requested field in the class represented by this class.
方法二:
int imageID =this.getResources().getIdentifier(this.getPackageName()+":drawable/dsc00002", null,null);
//int imageID = this.getResources().getIdentifier("dsc00002", "drawable", this.getPackageName());
ImageView imageview = new ImageView(this);imageview.setImageResource(imageID);
public int getIdentifier (String name, String defType, String defPackage)
Return a resource identifier for the given resource name. A fully qualified resource name is of the form "package:type/entry". The first two components (package and type) are optional if defType and defPackage, respectively, are specified here.
Note: use of this function is discouraged. It is much more efficient to retrieve resources by identifier than by name.
Parameters
name The name of the desired resource. defType Optional default resource type to find, if "type/" is not included in the name. Can be null to require an explicit type. defPackage Optional default package to find, if "package:" is not included in the name. Can be null to require an explicit package.
Returns
- int The associated resource identifier. Returns 0 if no such resource was found. (0 is not a valid resource ID.)
Parameters
name | The name of the desired resource. |
---|---|
defType | Optional default resource type to find, if "type/" is not included in the name. Can be null to require an explicit type. |
defPackage | Optional default package to find, if "package:" is not included in the name. Can be null to require an explicit package. |
Returns
- int The associated resource identifier. Returns 0 if no such resource was found. (0 is not a valid resource ID.)
批次圖檔:
public int[] getImageID() {
int[] output;
List
for (Field f : R.drawable.class.getDeclaredFields()) {
try {
Object object = f.get(R.drawable.class);
if (object instanceof Integer) {
list.add((Integer) object);
}
} catch (Exception e) {
Toast.makeText(myContext, "圖片載入失敗", Toast.LENGTH_SHORT).show();
}
}
output = new int[list.size()];
for (int i = 0; i <>
output[i] = list.get(i).intValue();
}
return output;
}