Use sharedPreferences and access the values at any of your class
Put the below code at SamplePreferences.java
private static final String TOTALCOUNT = "total_count";
public static void setTotalCount(Context thisActivity, String id) {
    Editor editor = thisActivity.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit();
    editor.putString(TOTALCOUNT, id);
    editor.commit();
}
public static String getTotalCount(Context thisActivity) {
    SharedPreferences user_pref = thisActivity.getSharedPreferences(KEY, Context.MODE_PRIVATE);
    return user_pref.getString(TOTALCOUNT, "0");
}
You can set the values from any of your class use below code
SamplePreferences.setTotalCount(thisContext, "2");
Access that value using below code
SamplePreferences.getTotalCount(thisContext);