Saturday, 26 January 2013

Create Database using Xml in android

Here in this blog i create database using of xml file such as (res / xml / tables.xml).
Create xml folder in res directory and create file like tables.xml.


<?xml version="1.0" encoding="ISO-8859-1"?>
<database name="andando_db" version="5">
<table name="categories" to-string="%name%" backup="no"
   <field name="name" obligatory="true" type="string-identifier" size="128"/>
<field name="default_time_gps" type="integer" obligatory="true" default="1" />
<field name="default_distance_gps" type="integer" obligatory="true" default="5" />
<field name="position" type="integer" obligatory="true" default="1" new-in-version="2" />
  </table>
 <table name="types_resource" to-string="%name%" backup="no"
  <field name="name" obligatory="true" type="name" size="128"/> 
 </table>
  
 </database>
As above code i create two simple table.

No comments:

Post a Comment