The android.os.Message uses a Bundle to send with it\'s sendMessage-method. Therefore, is it possible to put a HashMap inside a
Please note: If you are using a AppCompatActivity, you will have to call the
protected void onSaveInstanceState(Bundle outState) {} (NOT public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {}) method.
Example code...
Store the map:
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putSerializable("leftMaxima", leftMaxima);
outState.putSerializable("rightMaxima", rightMaxima);
}
And receive it in onCreate:
if (savedInstanceState != null) {
leftMaxima = (HashMap) savedInstanceState.getSerializable("leftMaxima");
rightMaxima = (HashMap) savedInstanceState.getSerializable("rightMaxima");
}
Sorry if it's some kind of a duplicate answer - maybe someone will find it useful. :)