<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating a SQLite database in Android</title>
	<atom:link href="http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/</link>
	<description>Tales of the Wisconsin Experience</description>
	<lastBuildDate>Mon, 12 Jul 2010 07:18:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Amol</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13630</link>
		<dc:creator>Amol</dc:creator>
		<pubDate>Mon, 12 Jul 2010 07:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13630</guid>
		<description>Nice article</description>
		<content:encoded><![CDATA[<p>Nice article</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13591</link>
		<dc:creator>Alberto</dc:creator>
		<pubDate>Tue, 23 Mar 2010 22:23:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13591</guid>
		<description>Hi!!!

amazing, post!! :P 

:)</description>
		<content:encoded><![CDATA[<p>Hi!!!</p>
<p>amazing, post!! <img src='http://www.hdelossantos.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  </p>
<p> <img src='http://www.hdelossantos.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paresh N. Mayani</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13590</link>
		<dc:creator>Paresh N. Mayani</dc:creator>
		<pubDate>Fri, 05 Mar 2010 07:26:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13590</guid>
		<description>Being novice of android development............
i have read this article and i feel that this article help me a lot......

thanx</description>
		<content:encoded><![CDATA[<p>Being novice of android development&#8230;&#8230;&#8230;&#8230;<br />
i have read this article and i feel that this article help me a lot&#8230;&#8230;</p>
<p>thanx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tiger</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13581</link>
		<dc:creator>Tiger</dc:creator>
		<pubDate>Thu, 04 Feb 2010 16:12:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13581</guid>
		<description>Hi,
I was wondering, I have seen many examples/tutorials on creating and accessing an SQLite database with Android.. But what I was wondering, every example I have seen always creates a Database with just one Table...
I&#039;d like to create a database with let&#039;s say 10 tables...
Do you know any efficient way to do so, should these be created within the onCreate() method, and if so how would the syntax be ?
I have tried this and for some reason on my emulator it seems like only the first passed Table is created....</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I was wondering, I have seen many examples/tutorials on creating and accessing an SQLite database with Android.. But what I was wondering, every example I have seen always creates a Database with just one Table&#8230;<br />
I&#8217;d like to create a database with let&#8217;s say 10 tables&#8230;<br />
Do you know any efficient way to do so, should these be created within the onCreate() method, and if so how would the syntax be ?<br />
I have tried this and for some reason on my emulator it seems like only the first passed Table is created&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hanly</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13522</link>
		<dc:creator>Hanly</dc:creator>
		<pubDate>Sat, 09 Jan 2010 08:25:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13522</guid>
		<description>The database gets upgraded every time you run the application. The only way it gets deleted is if you uninstall the application manually from the phone (Settings -&gt; Applications -&gt; Manage Applications -&gt; App Name...). This is the way I usually do it since it is faster. 

You can also start the emulator by opening the &quot;Android SDK and AVD manager&quot; where you created the virtual device. Start it from there and a window will pop up with an option to &quot;Clear user data&quot;. That way requires closing and restarting the emulator, which takes way too long to load. The other way all you have to do is uninstall the application and do a run as from eclipse again.</description>
		<content:encoded><![CDATA[<p>The database gets upgraded every time you run the application. The only way it gets deleted is if you uninstall the application manually from the phone (Settings -&gt; Applications -&gt; Manage Applications -&gt; App Name&#8230;). This is the way I usually do it since it is faster. </p>
<p>You can also start the emulator by opening the &#8220;Android SDK and AVD manager&#8221; where you created the virtual device. Start it from there and a window will pop up with an option to &#8220;Clear user data&#8221;. That way requires closing and restarting the emulator, which takes way too long to load. The other way all you have to do is uninstall the application and do a run as from eclipse again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bara</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13521</link>
		<dc:creator>Bara</dc:creator>
		<pubDate>Sat, 09 Jan 2010 05:00:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13521</guid>
		<description>That seemed to do it!  

You&#039;ve been a great help so far, but I had a few more questions for you:

1. Does the database get deleted every time I restart the emulator? 

2. If not, what would be the best way of deleting it (or even emptying it) quickly?  I could just do adb shell and sqlite3 and do a delete statement in the command line, but I was hoping for a faster solution.

Thanks again for all the help!</description>
		<content:encoded><![CDATA[<p>That seemed to do it!  </p>
<p>You&#8217;ve been a great help so far, but I had a few more questions for you:</p>
<p>1. Does the database get deleted every time I restart the emulator? </p>
<p>2. If not, what would be the best way of deleting it (or even emptying it) quickly?  I could just do adb shell and sqlite3 and do a delete statement in the command line, but I was hoping for a faster solution.</p>
<p>Thanks again for all the help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hanly</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13520</link>
		<dc:creator>Hanly</dc:creator>
		<pubDate>Fri, 08 Jan 2010 19:01:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13520</guid>
		<description>Thanks for letting me know. The problem seemed to be when the table creation string was being generated and commas were being added to the end of the key options. The code assumed that there would always be a key option for every key, which isn&#039;t always the case. Having put &quot;null&quot; into the key options array for every key would not have caused the error. However, I edited and updated the code so that it no longer assumes there will be a key option for every key.

[code lang=&quot;java&quot;]
for(int i = 0; TABLE_KEYS.size() &gt; i; i++){
			
			// Add commas to the options elements if there is a next value.
			if(i + 1 &lt; TABLE_OPTIONS.size() &amp;&amp; TABLE_OPTIONS.get(i) != null){
				TABLE_OPTIONS.set(i, TABLE_OPTIONS.get(i) + &quot;,&quot;);
			}else if (i + 1 == TABLE_OPTIONS.size() &amp;&amp; TABLE_OPTIONS.get(i) != null) {
				if(i + 1 &lt; TABLE_KEYS.size()){
					TABLE_OPTIONS.set(i, TABLE_OPTIONS.get(i) + &quot;,&quot;);
				}else {
					TABLE_KEYS.set(i, TABLE_KEYS.get(i) + &quot;&quot;);
				}
			}else if (i + 1 != TABLE_KEYS.size()) {
				TABLE_KEYS.set(i, TABLE_KEYS.get(i) + &quot;,&quot;);
			}else {
				TABLE_KEYS.set(i, TABLE_KEYS.get(i) + &quot;&quot;);
			}
			
			System.out.println(TABLE_OPTIONS.toString());
			System.out.println(TABLE_KEYS.toString());
			
			if(i + 1 &lt;= TABLE_OPTIONS.size() &amp;&amp; TABLE_OPTIONS.get(i) != null)
				keyString = keyString + &quot; &quot; + TABLE_KEYS.get(i) + &quot; &quot; + TABLE_OPTIONS.get(i);
			else if(i + 1 &gt; TABLE_OPTIONS.size() &#124;&#124; TABLE_OPTIONS.get(i) == null){
				keyString = keyString + &quot; &quot; + TABLE_KEYS.get(i);
			}
}
[/code]

I&#039;m glad this code has helped you. I found it somewhat confusing when I was learning to do this myself so I tried to write a tutorial that explained things in better detail than what I found. Let me know if you run into any more problems.</description>
		<content:encoded><![CDATA[<p>Thanks for letting me know. The problem seemed to be when the table creation string was being generated and commas were being added to the end of the key options. The code assumed that there would always be a key option for every key, which isn&#8217;t always the case. Having put &#8220;null&#8221; into the key options array for every key would not have caused the error. However, I edited and updated the code so that it no longer assumes there will be a key option for every key.</p>
<pre class="brush: java;">
for(int i = 0; TABLE_KEYS.size() &gt; i; i++){

			// Add commas to the options elements if there is a next value.
			if(i + 1 &lt; TABLE_OPTIONS.size() &amp;&amp; TABLE_OPTIONS.get(i) != null){
				TABLE_OPTIONS.set(i, TABLE_OPTIONS.get(i) + &quot;,&quot;);
			}else if (i + 1 == TABLE_OPTIONS.size() &amp;&amp; TABLE_OPTIONS.get(i) != null) {
				if(i + 1 &lt; TABLE_KEYS.size()){
					TABLE_OPTIONS.set(i, TABLE_OPTIONS.get(i) + &quot;,&quot;);
				}else {
					TABLE_KEYS.set(i, TABLE_KEYS.get(i) + &quot;&quot;);
				}
			}else if (i + 1 != TABLE_KEYS.size()) {
				TABLE_KEYS.set(i, TABLE_KEYS.get(i) + &quot;,&quot;);
			}else {
				TABLE_KEYS.set(i, TABLE_KEYS.get(i) + &quot;&quot;);
			}

			System.out.println(TABLE_OPTIONS.toString());
			System.out.println(TABLE_KEYS.toString());

			if(i + 1 &lt;= TABLE_OPTIONS.size() &amp;&amp; TABLE_OPTIONS.get(i) != null)
				keyString = keyString + &quot; &quot; + TABLE_KEYS.get(i) + &quot; &quot; + TABLE_OPTIONS.get(i);
			else if(i + 1 &gt; TABLE_OPTIONS.size() || TABLE_OPTIONS.get(i) == null){
				keyString = keyString + &quot; &quot; + TABLE_KEYS.get(i);
			}
}
</pre>
<p>I&#8217;m glad this code has helped you. I found it somewhat confusing when I was learning to do this myself so I tried to write a tutorial that explained things in better detail than what I found. Let me know if you run into any more problems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bara</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13518</link>
		<dc:creator>Bara</dc:creator>
		<pubDate>Fri, 08 Jan 2010 06:21:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13518</guid>
		<description>Thank you very much!  Your code has really helped me in understanding how databases work in Android. 

FYI, I believe there&#039;s a bug in the InsertEntry() method.  When I ran the method in my code I got an IndexOutOfBoundsException (Invalid location 4, size is 4) in the for loop.  Changing it to this seemed to fix it: key.size() - 1.</description>
		<content:encoded><![CDATA[<p>Thank you very much!  Your code has really helped me in understanding how databases work in Android. </p>
<p>FYI, I believe there&#8217;s a bug in the InsertEntry() method.  When I ran the method in my code I got an IndexOutOfBoundsException (Invalid location 4, size is 4) in the for loop.  Changing it to this seemed to fix it: key.size() &#8211; 1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hanly</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13516</link>
		<dc:creator>Hanly</dc:creator>
		<pubDate>Fri, 08 Jan 2010 04:25:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13516</guid>
		<description>Hi Bara, sorry I took so long. I actually intended to write a quick sample program demonstrating how to use this class sooner. Anyway, I created a sample where the class is used to populate a ListView. You can find it  at http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/</description>
		<content:encoded><![CDATA[<p>Hi Bara, sorry I took so long. I actually intended to write a quick sample program demonstrating how to use this class sooner. Anyway, I created a sample where the class is used to populate a ListView. You can find it  at <a href="http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/" rel="nofollow">http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bara</title>
		<link>http://www.hdelossantos.com/2009/12/23/creating-a-sqlite-database-in-android/comment-page-1/#comment-13514</link>
		<dc:creator>Bara</dc:creator>
		<pubDate>Thu, 07 Jan 2010 05:43:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=477#comment-13514</guid>
		<description>Would it be possible to provide a sample where this class is used and data is shown in a ListView?  Or not even that far, just how to use the class and get a list of queries.  It&#039;s a bit confusing.</description>
		<content:encoded><![CDATA[<p>Would it be possible to provide a sample where this class is used and data is shown in a ListView?  Or not even that far, just how to use the class and get a list of queries.  It&#8217;s a bit confusing.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.427 seconds -->
<!-- Cached page served by WP-Cache -->
