Let's say that I'm using an intent to get info back to the main class that called the current activity.
What would happen if say, I had two methods that might overlap the same field, like:
myIntent.putExtra("returnVal1",1000);
// many lines of code, later on...
myIntent.putExtra("returnVal1",5);
Would the "开发者_StackOverflowreturnVal1" be updated to 5 in the intent, will it stay at 1000, or will this cause runtime crashes?
Thanks in advance, sent from mobile, not at a computer with eclipse atm or I would test myself!
It will overwrite it. The extra attributes are essentially a single-value hash: new values overwrite any existing values.
精彩评论