@Override protected void onResume() { super.onResume(); Log.d(TAG, "onResume"); String text = Integer.toString(mBigArrayHolder.getRandom()); mTextView.setText(text); }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate"); BigArrayHolder bigArrayHolder = (BigArrayHolder) getLastCustomNonConfigurationInstance(); if (bigArrayHolder != null) { Log.d(TAG, "last custom non configuration instance is a BigArrayHolder"); mBigArrayHolder = bigArrayHolder; } else { Log.d(TAG, "creating new BigArrayHolder"); mBigArrayHolder = BigArrayHolder.newInstance(); } setContentView(R.layout.activity_main); mTextView = (TextView) findViewById(R.id.text_view); }
public static BigArrayHolder newInstance() { BigArrayHolder bigArrayHolder = new BigArrayHolder(); bigArrayHolder.randomize(); return bigArrayHolder; }