小编use*_*302的帖子

如何计算android中每个应用程序的移动和wifi数据使用情况?

有没有办法使用TrafficStats'(getUidRxBytes,getUidTxBytes,getTotalRxbytes,getTotalTXbytes,getMobileRxBytes,getMobileTxBytes)方法计算Android中每个应用程序的移动和wifi使用情况?我知道必须有一些方法可以做到这一点,因为3G看门狗和其他一些应用程序提供了这些细节.

有人可以帮忙吗?谢谢

android usage-statistics android-data-usage

7
推荐指数
2
解决办法
5400
查看次数

如何在Singleton和SharedPreferences类中传递应用程序上下文

如何将应用程序上下文从Singleton类传递给SharedPreferences?我在其onActivityCreated(Bundle savedInstanceState)方法中有一个片段和一个GridView ,在项目单击时,我在logcat中得到NullPointerException:

03-30 05:12:54.784: E/AndroidRuntime(1950): FATAL EXCEPTION: main
03-30 05:12:54.784: E/AndroidRuntime(1950): java.lang.NullPointerException
03-30 05:12:54.784: E/AndroidRuntime(1950):     at android.preference.PreferenceManager.getDefaultSharedPreferencesName(PreferenceManager.java:374)
03-30 05:12:54.784: E/AndroidRuntime(1950):     at android.preference.PreferenceManager.getDefaultSharedPreferences(PreferenceManager.java:369)
03-30 05:12:54.784: E/AndroidRuntime(1950):     at com.example.duaapp.utility.SharedPreferencesSupplication.save(SharedPreferencesSupplication.java:35)
Run Code Online (Sandbox Code Playgroud)

单身人士班

public class SingletonClass {

    public static Context applicationContext;

    public static int fontSizeMin = 17;
    public static int fontSizeMax = 35;

public static final String keySelVerseFromList = "keySelVerseFromList";
    public static final String keyFavVerses = "keyFavVerses";
    public static final String keyListOfVerses = "keyListOfVerses";

    public static final String keyIsFavSelected = "keyIsFavSelected";

} …
Run Code Online (Sandbox Code Playgroud)

singleton android nullpointerexception android-context sharedpreferences

3
推荐指数
1
解决办法
9718
查看次数