android - How can I save an Array after closing an Activity and load it back if the same activity called? -


i have following code implemented doesnt work want:

my onsaveinstancestate , restore:

@override public void onsaveinstancestate(bundle savedinstancestate) {     super.onsaveinstancestate(savedinstancestate);     savedinstancestate.putintarray("colorarray", colorarraysave); }  @override public void onrestoreinstancestate(bundle savedinstancestate) {     super.onrestoreinstancestate(savedinstancestate);     colorarraysave = savedinstancestate.getintarray("colorarray"); } 

my onstop, onresume, onpause methods:

@override protected void onpause() {     super.onpause();     savegridviewcolor(colorarraysave); }  @override protected void onstop() {     super.onstop();     savegridviewcolor(colorarraysave); }  @override protected void onresume() {     super.onresume();     colorthegridview(colorarraysave); } 

so have int array want save if activity stopped/closed , load instanly if activity called again code use doesnt work.

  • savegridviewcolor() saving int[] array colorarraysave
  • colorthegridview() coloring gridview items via int array.

any ideas how can working?


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -