1. 在控制台 input keyevent <系统按键码>
BACK 4
2.在控制台 am start -n <包名/Activity名>
3.在 xml里引用系统定义的资源
android:text="@android:string/cancel"
android:textColor="@android:color/white"
4.模拟按键
private void simulateKeystroke(int KeyCode) {
Instrumentation lInst = new Instrumentation();
KeyEvent keyUp = new KeyEvent(KeyEvent.ACTION_UP,KeyCode);
KeyEvent keyDwn = new KeyEvent(KeyEvent.ACTION_DOWN,KeyCode);
lInst.sendKeySync(keyUp);
lInst.sendKeySync(keyDwn);
}
5.SD卡根目录路径
public static String getSdCardAbsolutePath(){
return Environment.getExternalStorageDirectory().getAbsolutePath();
}
6.TextView 走马灯效果,加入以下三行代码:
1.android:singleLine="true"
2.android:marqueeRepeatLimit="marquee_forever"
3.android:ellipsize="marquee"
然后在对应的代码中加入该方法:
1.text.setFocusableInTouchMode(true);
7.所有在外部存储卡上的音乐文件的信息:
Cursor cursor = query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null,
null, null, MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
8.git 生产key,$ssh-keygen -t rsa