I’ve just been digging around in some of my old projects and found my Hours Manager application.
The purpose of the application is to provide me with a way of logging the hours that I do, given that my schedule is so busy, trying to remember when I did what can often be challenging. Unfortunately it never saw the light of day again due to my hectic schedule.
Given that again I am in a situation where having a log of my work schedule would be beneficial, of course you may be wondering, why don’t I just download one of the many good time management apps for the play store? The answer for me is simple, what would I learn from that?
Programming in Java is something new for me and I have various other android app’s that i have developed in the past although none of which have ever been polished enough to publish. Therefore I’m making a real effort to get this app on the market, not for profit just for the whole experience of releasing an application.
The challenge I have overcome today was adding the functionality to allow users to delete entries from the sql database. To do so I wanted a dialog window to pop up when the user long pressed one of the entries in the list view.
The code that follows simply creates a new Alert Dialog window from within the SQL View fragment, from there two buttons are initialized (one to confirm and one to cancel). The database is also queried to ensure that the correct item is successfully removed, then the array adapter is notified that the data has changed. From there the list view adapter is updated with a new incarnation of the database.
Hopefully this snippet help’s someone else who’s struggling with creating a Alert Dialog within a Fragment.
|Alert Dialog displaying record information|