intercept Boolean Param from Bundle - Android android.os

Android examples for android.os:Bundle

Description

intercept Boolean Param from Bundle

Demo Code

import android.content.Intent;
import android.os.Bundle;

public class Main {

  public static boolean interceptBooleanParam(Bundle savedInstanceState, Intent intent, String paramName) {
    boolean ret = false;

    if (savedInstanceState != null) {
      ret = savedInstanceState.getBoolean(paramName, false);
    } else {//from w  w  w.ja va  2 s.  c om
      if (intent != null) {
        Bundle incomming = intent.getExtras();
        if (incomming != null) {
          ret = incomming.getBoolean(paramName, false);
        }
      }
    }

    return ret;
  }

}

Related Tutorials