Eatwhatapp Development Combat (eight)

Source: Internet
Author: User

In the app Add, delete function has, this time we do change function.  Modify the store name in the corresponding entry when you click the items item in the project. Click items to jump out of a dialog box containing the input box, modify button, and Cancel button:
Alertdialog.builder builder = new Builder (mainactivity.this);  Builder.settitle ("delete?"); Final EditText et =  new EditText (mainactivity.this);
Builder.setview (ET); Builder.setpositivebutton ("Modify", new Dialoginterface.onclicklistener () {@Override public void OnClick (DIALOGINTERFAC  e dialog, int which) {modify logic}}); Builder.setnegativebutton ("Cancel", new Dialoginterface.onclicklistener () {@Override public void OnClick (DIALOGINTERFAC    e dialog, int which) {//dialog box delete Dialog.dismiss (); }  });
Add the Modified code:
String name = Et.gettext (). toString (); if (name! = NULL &&! "). EndsWith (name)) {    //modify Local Data    Upda (name,shoplist.get (position));    Modify the corresponding data inside the shoplist    shoplist.get (position). SetName (name);    Refresh    shopadapter.notifydatasetchanged ();}
Implement Updatelocaldata ():
private void Updatelocaldata (String name,shop shop) {contentvalues values = new Contentvalues ();  Values.put ("Shopname", name); Db.update ("Shopinfo", values, "Shopname =?", New String[]{shop.getname ()});

  

Eatwhatapp Development Combat (eight)

Related Article

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.