Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

context.setAttribute (object)

 
Sherif Shehab
Ranch Hand
Posts: 485
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I got an question regarding context.setAttribute (object) , for instance :
here i made hashmap then put it as an attribute in the context, my question is , if i changed the "key1" after setting the hashMap in the context , is it will be reflected directly or i need to write context.setAttribute ("hashMap", temp) ; after line 4 ?
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll find the answer by printing out the contents of the hash map after the 4th line!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reference to the HashMap now exists in two places - local variable and context, but it is still the same HashMap.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic