Fragment中獲取Activity的Context時只需要this.getActivity()即可.
而不是許多人說的this.getActivity().getApplicationContext(),如果用后者傳入AlterDialog肯定會報錯(android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application).
因為只有activity才可以再開新的窗口.
轉自:http://blog.chinaunix.net/uid-20544507-id-4262564.html
