Eatwhatapp Development Combat (11)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.