getStringExtra - Public Static Final - The Busy Coder's Guide to Android -


i on page 301 of book , example of activity getting "extras" intent started it. new java maybe missing pretty obvious but... thought when declare variable "final" meant doesn't change.

there line of code initialising final variable:

public static final string extra_message="msg";

and later in oncreate method:

tv.settext(getintent().getstringextra(extra_message));

the text displayed in activity not "msg" string passed intent "i other activity". why have have variable declaration above code work? don't understand doing.

thanks

you getting extra received activity indexed key 'msg'.

like when intent used start activity:

intent.putextra("msg", "text going in textview"); 

the key 'msg', value textview 'text going in textview'


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -