In my application i want to maintain data without using the local DB even if the application closes. For this i created one class in my app, in that i created static variables so we can access them anywhere in the app. But here some times data is gone i don't know why it's happen. this process is good or any better is there? Somewhere i read that Shared Preferences is useful but i don't know about that.please can anyone share your ideas.
public class AJ_Constant {
//New Food Item
public static String strEntrySavedFoodItem = "";
public static String strReportsSavedFoodItem = "";
public static ArrayList<String> arrFoodItems = new ArrayList<String>();
}
public class ReportsContentActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View contentView = LayoutInflater.from(getParent()).inflate(R.layout.reports_content, null);
setContentView(contentView);
AJ_Constant.arrFoodItems.add("Sample"); }}
thanks