Creating databases

by Neilz » Tue, 15 Dec 2009 07:42:36 GMT

Sponsored Links
 I've made a few apps now, which use an SQLite database, no problems.
In my latest app, I want two tables, and I just realised that every
example I can find only creates one table.

So, is this a limitation? Must I use only one table? Assuming I can
use two, how do I go about changing my create script? Here's a normal
one, as per the examples:

private static final String DATABASE_CREATE =
                "create table myTable (_id integer primary key autoincrement,
                        + "description text not null); " ;

If there's an example elsewhere, I'd be grateful for a link... thanks.


Creating databases

by Mark Murphy » Tue, 15 Dec 2009 07:46:49 GMT


In onCreate() of your SQLiteOpenHelper, you can call execSQL() as many
times as you like, to execute as many SQL statements as you like. You
can have as many tables, indices, triggers, and whatnot as SQLite
allows, certainly greater than one of each.

So, call execSQL() once to create one table and once to create another
table. Or, courtesy of that semicolon, you may be able to put both
CREATE TABLE statements in a single string -- I haven't tried that.

Mark Murphy (a Commons Guy)  | 

Android App Developer Training: 


Sponsored Links

Creating databases

by jeffro » Wed, 16 Dec 2009 00:49:14 GMT

 Here's an example:

        public void onCreate(SQLiteDatabase db) {
                Log.d(getClass().getName(), "Creating Database.");

and the I have final strings like the following that contain the SQL
to create the table:

    private static final String VEHICLE_CREATE =
        "create table vehicle (_id integer primary key autoincrement,
vehicle text not null,notes text, selected boolean not null default
false,vehicle_uri text,weight real default 0.0,drivetrain_loss integer
default 17);";

Trackmaster - Motorsports Lap Timer 
Dynomaster - Performance Dyno 


Other Threads

1. Removal / Recovery from Android Emulator on OS X

I recently began using the Android SDK on a Macbook Pro. Today as I
was coding, I was listening to music through an external DAC connected
to the USB output of the laptop. I noticed a lot of interference in
the audio, so I switched USB ports and the problem was solved.
However, I then restarted the Android emulator and the interference
immediately began on the second USB port. Now both of my USB ports
produce audibly distorted audio even when the emulator is not running.
I have tried emulator -wipe-data and emulator -noaudio to no avail.
How can I undo whatever the emulator did to my USB audio output?

Thanks in advance.


2. Need help in the development and use JMCAD

Need help in the development and use JMCAD

Project Information

JMCAD is an program for the modeling and simulation of complex dynamic
systems. This includes the ability to construct and simulate block diagrams.
The visual block diagram interface offers a simple method for constructing,
modifying and maintaining complex system models. The simulation engine
provides fast and accurate solutions for linear, nonlinear, continuous time,
discrete time, time varying and hybrid system designs. With JMCAD, users can
quickly develop software or "virtual" prototypes of systems or processes to
demonstrate their behavior prior to building physical prototypes.

The user builds his system model by selecting predefined blocks from a block
library and simply wiring the blocks together. Each block of the diagram
performs a function. Users can also create custom blocks in Java and add
them to the JMCAD block library.

JMCAD is a block diagram language for creating complex nonlinear dynamic
systems. Its fast execution speed is perfect for model based operator
training, off-line controller tuning, and hardware in the loop testing. Its
efficient Java code generator makes it a great platform for model based
embedded system development.

By combining the simplicity and clarity of a block diagram interface with a
high-performance mathematical engine, JMCAD provides fast and accurate
solutions for linear, nonlinear, continuous time, discrete time, multi-rate,
and hybrid systems. Moreover, JMCAD's tightly integrated development
platform makes it easy to pass freely between model construction,
simulation, optimization, and validation. This lets you create virtual
prototypes on your desktop to make sure your design works properly before
committing to prototype.

For specialized engineering problems, JMCAD offers a comprehensive set of
companion products for frequency domain analysis, Java code generation,
communications system modeling, DSP and embedded system design, neural
networks and real-time analog and digital I/O.

The program is developed with use of language Java and can be used in
various operational systems (Windows, Linux, Solaris, Unix, etc.).


3. Is there a way toresetthe android phone programatically? I mean is there any API to do this?

4. Help, can someone tell me how do this code works?

5. Installing WST in Eclipse

6. Saving Stats to Textfile

7. Calendar fail to launch in Cupcake 1.5