許多這樣的小tips, 記下來, 下次用到好找.
很簡單
android:stackFromBottom=”true”
activity設置為
android:focusableInTouchMode=”true”
edittext去掉requestFocusable
android:transcriptMode=”alwaysScroll”
android:showAsAction=”always”
File imgFile = new File(fileName);
Bitmap bitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
public static int bytesToInt(byte[] b) {
int value = 0;
for (int i = 0; i < 4; i++) {
int shift = i * 8;
value += (b[i] & 0x000000FF) << shift;
}
return value;
}
public static byte[] intToBytes(int a)
{
byte[] ret = new byte[4];
ret[0] = (byte) (a & 0xFF);
ret[1] = (byte) ((a >> 8) & 0xFF);
ret[2] = (byte) ((a >> 16) & 0xFF);
ret[3] = (byte) ((a >> 24) & 0xFF);
return ret;
}