Android

找到当前类的Context


本文地址: http://blog.csdn.net/caroline_wendy


假设是在onContinueCreate或onCreate中, 直接使用this, 就代表当前类的context;
假设在类的其它方法内, 则须要使用this.context, 就能够取代.

如:
PreferenceUtils.set(this, FIRST_ACCESS_PREF_TAG, true);
PreferenceUtils.set(StartAskActivity.this, FIRST_ACCESS_PREF_TAG, true);



原文地址:https://www.cnblogs.com/mthoutai/p/6919738.html