许多这样的小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;
}