Android Development 101- Part 4:Advanced Database/GUI Code and DDMS

In this tutorial we are going to cover some advanced database code as well as tie in to some more advanced GUI techniques. We left off on the last tutorial showing you how to insert and select data to/from the database as well as make a table. What we need now is to be able to delete data if it is not needed and update it if we entered it incorrectly. We will tie these abilities in with some more advanced functionality utilizing a long press on the screen for delete and for updating we will just press the data we want to edit.

The project we are about to dive into is from the Android Developers website called Notepad v2 with modifications to make it geared more towards our RandomQuotes Project. We are using an already made example then modifying it because it covers more advanced ground on the GUI and database sides which is excellent for beginners and great for more advanced users to push on with. Since the items will be displayed to us in a ListView we can no longer entitle this project RandomQuote but will instead use EnhancedQuotes as our project name. Just to be clear, we will be creating a whole new project instead of copying another one over. Here is the required information below to make the project

Project Name: EnhancedQuotes
Build Target: Android 1.5
Application Name: EnhancedQuotes
Package Name: com.gregjacobs.enhancedquotes
Create Activity: QuotesMain
Min SDK Version: 3

After your project is created we can start some more advanced GUI work and integrate that with some update and delete statements. At this point, I’d like to start dividing our code into different files based on the need of the application. This is important in modern programming because it allows us to stay organized and execute functions for different screens or layouts efficiently and effectively. For this project we are going to split our code into 3 .java files and we are going to have 3 different layout files as well. We will start off with the basics by creating a new class file in our package com.gregjacobs.enhancedquotes called QuotesDBAdapter. This will contain our database code but instead of using the previous database file we created, we will start a new one. Lets look at how Google does it and see whats available other than Raw Queries from the previous tutorial.

Read this full article at.

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: