發表文章

目前顯示的是 1月, 2012的文章

[Android] note 亂亂寫

§ How-to modify the content of .jar Download smali and baksmali from smali . Open the xxx.jar file with something such as winrar or 7zip or whatever you prefer. Copy out the classes.dex file. Run following from command line: java -jar baksmali.jar -o classout/ classes.dex Open the file xxx.smali that you want to modify in something like notepad or context or any text editor. Now back to the command line and run: java -Xmx512M -jar smali.jar classout/ -o new-classes.dex Open the services.jar file with your archiving tool again and replace the existing classes.dex file with our new classes.dex we just created. § Reflection 有時你會需要突破存取限制來呼叫受護的或私有的方法,這時候您可以使用反射機制來達到目的,一個存取私有方法的例子如下: Class c = Class.forName("com.jackal.private"); Method privateMethod = c.getDeclaredMethod("getPrivateMethod", arg0, arg1, ...); //privateMethod.setAccessible(true); privateMethod.invoke(instanceObj, arg0, arg1, ...); 即使宣告為私有方法或成員,仍可以透過反射機制存取私有方法,要突破權限仍是可以的。 Reference: 良葛格學習

安裝SCIM後無法打字

在ubuntu安裝了SCIM(嘸蝦米),只要切到eclipse,常常會遇到無法打字。用到差點都快把鍵盤敲爛了,十分的肚爛!所以拜問了谷歌大神,找到了解決的方法。 1. 設置SCIM為不自動啟動,因為SCIM在每次退出後會自動更改config文件 im-switch -s none 先執行完上述指令後重新登入 2. 修改 ~/.scim/config 中 /FrontEnd/X11/Dynamic 值為 true 再執行 im-switch -s scim 然後重新登入 Reference: 詳全文