I found the same questions on stack and used this way
public void setProgramAllProgress(int all){
SharedPreferences prefs = CApplication.getAppContext().getSharedPreferences(BASE_PATH,
Context.MODE_WORLD_READABLE);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt("all", all);
editor.commit();
}
public int getProgramAllProgress(String packageName){
Context con=null;
try {
con = CApplication.getAppContext().createPackageContext(packageName, 0);
SharedPreferences pref = con.getSharedPreferences(
BASE_PATH, Context.MODE_PRIVATE);
int data = pref.getInt("all", -1);
return data;
} catch (PackageManager.NameNotFoundException e) {
Log.e("Not data shared", e.toString());
}
return -1;
}
But it doesn't work. I get the context from package, but SharefPrefs are always empty.