Tuesday, August 23, 2011

Mobile Applications Development Week 4: ListViews and ViewFlippers

Ok. So in this week's class exercise, we had to continue working on the task manager. The new features we were supposed to have added by the end of the class included the ability to confirm deleting all of the tasks in the task list, send any given task in a text message and redesign the GUI so that it made use of the ViewFlipper widget.
The confirm dialog was reasonably easy. For this particular dialog, we only needed two buttons - one to delete all of the tasks and another to cancel the deletion process.
The SMS part worked at the beginning, when I sent all of the tasks in the text message. I had to run 2 emulators at the same time to do this. I also had to add the "android.permission.SEND_SMS" uses permission to the manifest file. Not to do so caused the compiler to throw a very lovely error.
The last part, switching to the ViewFlipper, was an interesting experience. After digging around online, I tried nesting the ListView inside the ViewFlipper inside my main.xml. The thinking being, I could use the ViewFlipper to navigate through the ListView items (my tasks) by using the "Next" and "Previous" buttons. So I ran my app and added a few dummy items. Lo and behold, the items were being displayed as normal ListView items. This isn't what I wanted! Next I tried moving the ViewFlipper to my task item xml file and wiring things up via the task item's java class. This only made my app crash. So it was back to the main.xml file for the ViewFlipper.
Sigh. With luck this baby will be in the bag by the time I head to bed tomorrow night.
But to owe the truth, I would much rather being working on my pet projects right now.

No comments:

Post a Comment