コード例 #1
0
  @Override
  protected void onResume() {
    super.onResume();
    Log.d(TAG, "onResume");

    String text = Integer.toString(mBigArrayHolder.getRandom());

    mTextView.setText(text);
  }
コード例 #2
0
  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);
  }
コード例 #3
0
 public static BigArrayHolder newInstance() {
   BigArrayHolder bigArrayHolder = new BigArrayHolder();
   bigArrayHolder.randomize();
   return bigArrayHolder;
 }