Before we implemented the click Item Jump activity, we then added the arguments on its basis to the delivery. In the Onitemclick () inside the mainactivity:
String name = Shoplist.get (position). GetName ();//Intent Intent it = new Intent (); The//bundle object bundle class is used as the carrying data, which resembles a map, A value that holds the form of a Key-value name value pair. Bundle Mbundle = new Bundle (), mbundle.putstring ("name", name),//Store data It.putextras (mbundle);//Jump Activityit.setclass ( Mainactivity.this, Shopinfoactivity.class);//intention to open startactivity (it);
In the shopinfoactivity:
Declaring variables private TextView shopname;
Add init () in the Oncreat () method:
Init ();p rivate void init () { //Initialize control shopname = (TextView) Findviewbyid (r.id.tv_shop_name); Implement the method, get mainactivity pass over the parameter Shopname.settext (GetData ());}
Implement GetData ():
Private String GetData () { Intent it = getintent (); Bundle Mbundle = It.getextras (); String name = mbundle.getstring ("name"); return name;
This way, you can get the store name when you click Jump.
Eatwhatapp Development Combat (11)