On the show billing detail in the previous section, Bill details of the display has been basically implemented, this article mainly to organize the code, to achieve this window query and delete functions; When the menu is pressed, the window of the selected month is displayed, and the month of detail is selected; on the ListView, press the dialog box that pops up to confirm deletion to complete the deletion.
The following figure:
There is a Onitemlongclicklistener event in this case, and the use of this event is as follows:
First the activity inside implements Onitemlongclicklistener, and then as written in the following code:
Java code
//here ListView Add listening Event Lv.setonitemlongclicklistener (this); Handling Delete actions in the activity's Onitemlongclick event public boolean Onitemlongclick (adapterview<?> parent, view view, int PO
Sition, long id) {_id= (int) ID; New Alertdialog.builder (this). Settitle ("hint"). Setmessage ("OK to delete this detail?"). SetIcon (R.drawable.quit). Setpositivebutton ("OK", new Dialoginterface.onclicklistener () {public void OnClick (Di
Aloginterface dialog, int whichbutton) {//log.v ("", "" +_id);
Billdb.delbills (_id);
Madapter.changecursor (cur);
((Simplecursoradapter) madapter). notifydatasetchanged ();
Finish (); }). Setnegativebutton ("Cancel", new Dialoginterface.onclicklistener () {public void OnClick (Dialoginterface D
Ialog, int whichbutton) {}}). Show ();
return true; }
After so many days of study, my colabox from the input to show details of the section are basically almost done, this article to tidy up the code, the need to improve the place, the example is temporarily here.
Series of articles:
Android Personal Finance Tool Six: Show billing details below
Android Personal Finance tool five: show billing details
Android Personal Finance Tools Four: Add Bill page below
Android Personal Finance Tool Three: Add Bill page
Android Personal Finance Tools two: Use SQLite to implement initialization data at startup
Android Personal Finance Tools One: Project overview and implementation of the launch interface
That's what Android's personal finance tools are all about, and it's a good tutorial for people who start learning about Android apps!