About Extra


#1
protected void onCreate(Bundle savedInstanceState) {		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_cheat);
		mAnswerIsTrue = getIntent().getBooleanExtra(EXTRA_ANSWER_IS_TRUE, false);  //here? 
		
		mAnswerTextView = (TextView)findViewById(R.id.answerTextView);
		
		mShowAnswer = (Button)findViewById(R.id.ShowAnswerButton);
		mShowAnswer.setOnClickListener(new View.OnClickListener() {

in the upper code
mAnswerIsTrue = getIntent().getBooleanExtra(EXTRA_ANSWER_IS_TRUE, false);

why use ‘false’?
i tried it with ‘true’ and next method do same.
mAnswerIsTrue = getIntent().getBooleanExtra(EXTRA_ANSWER_IS_TRUE, true); <------- i tried it ‘true’ instead of false but it’s ok?

please explain me about second argument?


#2

The second argument is the default value.
In case the EXTRA_ANSWER_IS_TRUE is not found, mAnswerIsTrue will be false.


#3

Hey guys I am pretty new to this, but now I am reading up on extras because on my current assignment I have to write an extra for my radio buttons. Question is, do you need the model to write the extra?