Consider the following snippet of code: @Override protected void onStop { Super.onStop(); SharedPreferences setting = getSharedPreferences("MyPrefs", 0); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("MyBool", true); <some more code here> } Which of the following should be used <some more code here>?

Question:Consider the following snippet of code: @Override protected void onStop { Super.onStop(); SharedPreferences setting = getSharedPreferences("MyPrefs", 0); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("MyBool", true); <some more code here> } Which of the following should be used <some more code here>?

1.editor.save(); editor.close();

2.editor.save(); editor.finish();

3.editor.commit();

4.editor.save();


Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!