SiteMap

2014年5月9日金曜日

Firefox - userChrome Script


找到 firefox 的 profile 資料夾,
不知道的請按照下面步驟
Help →  Troubleshooting Information → Profile Folder → 按下show Folder


2014年5月1日木曜日

eclipse - 建立新Android Project的時候出現 java.lang.NullPointerException

剛剛新建立而已就出現了, 好吧不管你, 先來調整一下 xml 檔案
結果每點一下 xml 檔案的視覺介面( Graphical Layout ),
或者是直接 ctrl + o

都直接跳錯誤出來,

好吧, 在這種情況下只有跪了 0rz....

上網爬了下文, 弄新的 workspace 就可以解決

我熱淚盈眶阿我, 之前 new project 的介面莫名其妙多個 fragment.xml
的 Layout

再加上今天, 我.... 我 workspace 的更換數目已經到了 13 !!
而且看來以後還會新增下去

13, 這個數字多麼奇妙


Ref.
http://stackoverflow.com/questions/18091333/java-lang-nullpointerexception-when-creating-first-android-app-in-adt-mac-bundle

2014年4月26日土曜日

Android - SD Card

在 4.0 後,
Environment.getExternalStorageDirectory().getAbsolutePath();
得到的是內建的儲存空間

因為有些機種可以外接SD卡, 有些不行, 而 Android 沒有提供取得外接SD卡的方法,

2014年4月23日水曜日

MAC - shortcut


fn + "UP" arrow = page up
fn + "Down" arrow = page down
fn + "Right" arrow = move cursor to the end of line
fn + "Left" arrow = move cursor to the start of line

fn + delete = delete word after current cursor position


In windows 7

fn + ctrl + "Left" arrow = Home
fn + ctrl + "Right" arrow = End

ctrl + alt + "UP" arrow = screen turn to  0 angle (restore the default angle)
ctrl + alt + "Down" arrow = screen turn to 180 angle
ctrl + alt + "Left" arrow = screen turn to 270 angle
ctrl + alt + "Right" arrow = screen turn to 90 angle

Ref

http://support.apple.com/kb/HT1343

http://forums.macrumors.com/showthread.php?t=665383

Eclipse - Logcat

什麼是 Logcat ?

(暫無)

設定視窗( in Eclipse)

Window → Preferences → Android → Logcat

打開訊息視窗

Window → Show View → Other → Android → Logcat

2014年4月8日火曜日

Android - Toast 顯示很慢

   Toast可以用來顯示音量改變或者保存更新消息,如果用戶一直點擊,Toast會排隊一個一個的,直到消息隊列全部顯示完,這樣的效果顯然是不好的,下面來看解決方法

    Toast.makeText(activity, text, duration)每次會實例化一個Toast,所以

01 if (toast != null)
02    {
03        toast.setText(text);
04        toast.setDuration(duration);
05        toast.show();
06    } else
07    {
08        toast = Toast.makeText(activity, text, duration);
09        toast.show();
10    }

Android - Change Default Activity

Use the AndroidManifest.xml file, you can actually even have more than one launcher activity specified in your application manifest. To make an activity seen on the launcher you add these attributes to your activity in the manifest


        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>


Ref.
http://stackoverflow.com/questions/3631982/change-applications-starting-activity-android
http://stackoverflow.com/questions/9704898/how-to-set-my-activity-as-main-activity-in-android