2013年9月24日星期二

Ask a question of Intent putExtra method ?

Ask a question of Intent putExtra method ?

There are 3 Activity are A, B, C

A inside Intent First putExtra ("1", "1"); putExtra ("2", "2"); setclass (A.this, B.class);
B inside Intent First putExtra ("3", "3"); setclass (B.this, C.class);
C inside the Intent to receive these three keys do ?


That is inside the A key , after sending two jump B, B sends a key after the jump to C, C which can receive these three keys do ?

------ Solution ------------------------------------ --------
Oh , take less .

but must in B new Intent () then setBundle, parameters A of the Bundle,
------ Solution --------------- -----------------------------
every time a new intent, you can remove the first intent bundle, and then need to save the value of the deposit to the bundle , the bundle and then saved to the new intent, can be
------ Solution -------------- ------------------------------
from A -> B create an intent to obtain from A to B the intent, the intent of the values ​​stored in the 1,2 ;
final Intent getIntent = getIntent ();
from B -> C to create a new intent of the value added to it 1,2
Intent intent = new Intent ();
intent.putExtra ("3", "3");
intent.putExtra ("1", getIntent.getStringExtra ("1"));
intent.putExtra ("2", getIntent.getStringExtra ("2"));
There are two intent in B
so C will be able to accept the three values ​​in the

------ Solution ------------------------------------ --------
obviously only get to "3" corresponds to "3"

because A sends the intent defines B (setclass (A.this, B.class) ;) can receive key-value pairs ( "1", "1" ) ( " 2", " 2 " ) , empathy , B sends the intent defines C (setclass (B.this, C.class) ;) to receive key-value pairs (" 3 "," 3 ")
--- --- Solution --------------------------------------------

encapsulated objects , googl + Baidu

If you again take A, C, key-value pairs , then you re- B through a Bundle access , and then set, so that you can in C made ​​
---- - For reference only ---------------------------------------
; your mother to your father two packs of cigarettes , your father give you a lollipop , do you have your father's hand smoke do ?
------ For reference only ------ ---------------------------------
Oh, upstairs can not be so analogy, if passed an android With Intent object on the whole , android in preaching is not an Intent object
------ For reference only -------------------- -------------------
not a same intent
------ For reference only --------- ------------------------------
chartered case you kind of thing , Dad gave you all the possessions of course you will be able to smoke it. . . . .
------ For reference only -------------------------------------- -
this is not the mechanism of inheritance .
------ For reference only ---------------------------- -----------
What is an object ?
------ For reference only ---------------------------------------

can give a Bundle access code ? It is best to also add comments . . .


------ For reference only ---------------------------------- -----
not only through B, pour about
------ For reference only -------------------- -------------------


really can hold more than
------ For reference only ------------------------------- --------

really can hold more than
------ For reference only -------------------- -------------------

just sorry ah , that's not on the first floor , second floor

没有评论:

发表评论