<?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: Using a SQLite Database in Android</title>
	<atom:link href="http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/</link>
	<description>Tales of the Wisconsin Experience</description>
	<lastBuildDate>Mon, 30 Jan 2012 18:23:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: Nike Outlet Shoes For Sale</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-14031</link>
		<dc:creator>Nike Outlet Shoes For Sale</dc:creator>
		<pubDate>Sat, 17 Dec 2011 10:51:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-14031</guid>
		<description>Hi, I desired to ask you one thing. Is this site a wordpress web page? We’re contemplating switching our web page from Blogger to wordpress, do you think this is doable? In addition did you construct the following theme by yourself some how? Bless you for the assistance!</description>
		<content:encoded><![CDATA[<p>Hi, I desired to ask you one thing. Is this site a wordpress web page? We’re contemplating switching our web page from Blogger to wordpress, do you think this is doable? In addition did you construct the following theme by yourself some how? Bless you for the assistance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sharad</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-14007</link>
		<dc:creator>sharad</dc:creator>
		<pubDate>Wed, 23 Nov 2011 16:02:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-14007</guid>
		<description>thanks for the code. it works. But when i created test.db in SQLite explicitly (with column name &#039;name&#039;) and call above code. it works! but it did not update the test.db which i created. also i search through the hard drive but there is only one test.db  - the one which i created. where this database stores by default?</description>
		<content:encoded><![CDATA[<p>thanks for the code. it works. But when i created test.db in SQLite explicitly (with column name &#8216;name&#8217;) and call above code. it works! but it did not update the test.db which i created. also i search through the hard drive but there is only one test.db  &#8211; the one which i created. where this database stores by default?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jaber Shabeek</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-14002</link>
		<dc:creator>Jaber Shabeek</dc:creator>
		<pubDate>Mon, 14 Nov 2011 11:39:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-14002</guid>
		<description>hey man great effort i like it.... and learned a lot thank you very much...</description>
		<content:encoded><![CDATA[<p>hey man great effort i like it&#8230;. and learned a lot thank you very much&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Carr</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-13990</link>
		<dc:creator>Mike Carr</dc:creator>
		<pubDate>Wed, 12 Oct 2011 06:50:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-13990</guid>
		<description>Thanks for the tutorial   ...one of the few that really helped , But I need an example for something I haven`t seen . I have a database in my app and I need to retrieved the data from another activity (another screen with 6 buttons in it )   ... The buttons in the other activity are labeled  1-6 ... I need to click on a button , say #3  and retrieve the data from row 3 in my database and display it in a textView .  I would appreciate any help ....Thanks</description>
		<content:encoded><![CDATA[<p>Thanks for the tutorial   &#8230;one of the few that really helped , But I need an example for something I haven`t seen . I have a database in my app and I need to retrieved the data from another activity (another screen with 6 buttons in it )   &#8230; The buttons in the other activity are labeled  1-6 &#8230; I need to click on a button , say #3  and retrieve the data from row 3 in my database and display it in a textView .  I would appreciate any help &#8230;.Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: widhiecyber</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-13986</link>
		<dc:creator>widhiecyber</dc:creator>
		<pubDate>Fri, 07 Oct 2011 07:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-13986</guid>
		<description>this is great toturial
i&#039;m happy to visit here :)</description>
		<content:encoded><![CDATA[<p>this is great toturial<br />
i&#8217;m happy to visit here <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: android apps and games</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-13978</link>
		<dc:creator>android apps and games</dc:creator>
		<pubDate>Mon, 15 Aug 2011 18:06:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-13978</guid>
		<description>I love anything n everything that is composed nicely... thumbs up you got some good content going on there for sure.</description>
		<content:encoded><![CDATA[<p>I love anything n everything that is composed nicely&#8230; thumbs up you got some good content going on there for sure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: edward</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-13966</link>
		<dc:creator>edward</dc:creator>
		<pubDate>Wed, 02 Mar 2011 11:37:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-13966</guid>
		<description>link is broken</description>
		<content:encoded><![CDATA[<p>link is broken</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: farhan</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-13900</link>
		<dc:creator>farhan</dc:creator>
		<pubDate>Sun, 24 Oct 2010 16:47:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-13900</guid>
		<description>http://mfarhan133.wordpress.com/2010/10/24/database-crud-tutorial-for-android/

Its an excellent tutorial for android DB CRUD with
COMPLETE SOURCE CODE</description>
		<content:encoded><![CDATA[<p><a href="http://mfarhan133.wordpress.com/2010/10/24/database-crud-tutorial-for-android/" rel="nofollow">http://mfarhan133.wordpress.com/2010/10/24/database-crud-tutorial-for-android/</a></p>
<p>Its an excellent tutorial for android DB CRUD with<br />
COMPLETE SOURCE CODE</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nyasha</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-13876</link>
		<dc:creator>Nyasha</dc:creator>
		<pubDate>Sun, 19 Sep 2010 12:31:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-13876</guid>
		<description>great tutorial man. i have a question however. I am trying to use your DBAdapter but i want to use it with an existing database populated offline and added to the assets folder.I then want to be able to retrieve infomation from this database including bitmaps(blobs) and show them onto a listview which grows depending on items retrieved.Please help.this is how my database connection looks like

regards nyasha
public class dataHelper extends SQLiteOpenHelper{
	private final Context myContext;
	private  static String DB_PATH = &quot;data/data/android.vineetyadav.com.dbTest/databases/&quot;;
	private  static String DB_NAME  = &quot;Myfirst.db&quot;;
	private SQLiteDatabase myDatabase;	    
	public dataHelper(Context context) {
		super(context, DB_NAME, null, 1);
		this.myContext  = context;
	}


	public void createDataBase() throws IOException{
		// TODO Auto-generated method stub
		boolean dbExist = checkDatabase();
		if (dbExist) {
			
		}else {
			this.getReadableDatabase();
			
			try {
				copyDatabase();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				throw new Error(&quot;Error copying database&quot;);
			}
		}
	}



	private void copyDatabase() throws IOException {
		InputStream myInput =  myContext.getAssets().open(DB_NAME);
		String outFile = DB_PATH+DB_NAME;
		OutputStream myOutput = new FileOutputStream(outFile);
		byte[] buffer =  new byte[1024];
		int length;
		while((length = myInput.read(buffer)) &gt; 0) {
			myOutput.write(buffer, 0, length);
			
		}
		myOutput.flush();
		myInput.close();
		myOutput.close();
	}
	private boolean checkDatabase() {
		SQLiteDatabase checkDb = null;
		try {
			String myPath = DB_PATH+DB_NAME;
			checkDb = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
		} catch (SQLiteException e) {
			
		}
		
		if (checkDb != null) {
			checkDb.close();
		}
		return checkDb!= null ? true:false;
		
	}
	
	public void openDatabase() throws SQLiteException {
		String myPath = DB_PATH+DB_NAME;
		myDatabase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
	}
	@Override
	public synchronized  void close() {
		if (myDatabase != null) {
			myDatabase.close();
		}
		super.close();
	}
	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		
	}
	public Cursor doQuery(String query) {
		Cursor c = myDatabase.rawQuery(query,null);
		return c;
	}
}</description>
		<content:encoded><![CDATA[<p>great tutorial man. i have a question however. I am trying to use your DBAdapter but i want to use it with an existing database populated offline and added to the assets folder.I then want to be able to retrieve infomation from this database including bitmaps(blobs) and show them onto a listview which grows depending on items retrieved.Please help.this is how my database connection looks like</p>
<p>regards nyasha<br />
public class dataHelper extends SQLiteOpenHelper{<br />
	private final Context myContext;<br />
	private  static String DB_PATH = &#8220;data/data/android.vineetyadav.com.dbTest/databases/&#8221;;<br />
	private  static String DB_NAME  = &#8220;Myfirst.db&#8221;;<br />
	private SQLiteDatabase myDatabase;<br />
	public dataHelper(Context context) {<br />
		super(context, DB_NAME, null, 1);<br />
		this.myContext  = context;<br />
	}</p>
<p>	public void createDataBase() throws IOException{<br />
		// TODO Auto-generated method stub<br />
		boolean dbExist = checkDatabase();<br />
		if (dbExist) {</p>
<p>		}else {<br />
			this.getReadableDatabase();</p>
<p>			try {<br />
				copyDatabase();<br />
			} catch (IOException e) {<br />
				// TODO Auto-generated catch block<br />
				throw new Error(&#8220;Error copying database&#8221;);<br />
			}<br />
		}<br />
	}</p>
<p>	private void copyDatabase() throws IOException {<br />
		InputStream myInput =  myContext.getAssets().open(DB_NAME);<br />
		String outFile = DB_PATH+DB_NAME;<br />
		OutputStream myOutput = new FileOutputStream(outFile);<br />
		byte[] buffer =  new byte[1024];<br />
		int length;<br />
		while((length = myInput.read(buffer)) &gt; 0) {<br />
			myOutput.write(buffer, 0, length);</p>
<p>		}<br />
		myOutput.flush();<br />
		myInput.close();<br />
		myOutput.close();<br />
	}<br />
	private boolean checkDatabase() {<br />
		SQLiteDatabase checkDb = null;<br />
		try {<br />
			String myPath = DB_PATH+DB_NAME;<br />
			checkDb = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);<br />
		} catch (SQLiteException e) {</p>
<p>		}</p>
<p>		if (checkDb != null) {<br />
			checkDb.close();<br />
		}<br />
		return checkDb!= null ? true:false;</p>
<p>	}</p>
<p>	public void openDatabase() throws SQLiteException {<br />
		String myPath = DB_PATH+DB_NAME;<br />
		myDatabase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);<br />
	}<br />
	@Override<br />
	public synchronized  void close() {<br />
		if (myDatabase != null) {<br />
			myDatabase.close();<br />
		}<br />
		super.close();<br />
	}<br />
	@Override<br />
	public void onCreate(SQLiteDatabase db) {<br />
		// TODO Auto-generated method stub</p>
<p>	}</p>
<p>	@Override<br />
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {<br />
		// TODO Auto-generated method stub</p>
<p>	}<br />
	public Cursor doQuery(String query) {<br />
		Cursor c = myDatabase.rawQuery(query,null);<br />
		return c;<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: opy</title>
		<link>http://www.hdelossantos.com/2010/01/07/using-a-sqlite-database-in-android/comment-page-1/#comment-13721</link>
		<dc:creator>opy</dc:creator>
		<pubDate>Tue, 24 Aug 2010 15:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.hdelossantos.com/?p=518#comment-13721</guid>
		<description>Hey Daisy, can you actually query for anything?  Here is what I use to query for _id.  I do this so when they select a row the onitemclicklistener queries that row. &quot;columns&quot; is a String[] of rows.  All my rows are shown with quotes instead of using key_row.

queryString = query.getData(&quot;data.xml&quot;, columns, &quot;_id =&quot; + id, null, null, null, null, null);

From there you can have am EditText and save it to a String title and query the DB with the string.

In theory lol.

Now, I was wondering how I can input data into my DB outside of an activity.  When I remove the &quot;extends activity&quot; from the class it shows error for the line 

query = new DatabaseQuery(this);  

I need to have this run from a service that auto downloads and inputs the data every minute without calling an activity.  The service works but when it calls the activity to input data everything else goes to onPause and the input data activity takes focus then closes.  Then the screen flashes and the main activity goes to onResume and refreshes.</description>
		<content:encoded><![CDATA[<p>Hey Daisy, can you actually query for anything?  Here is what I use to query for _id.  I do this so when they select a row the onitemclicklistener queries that row. &#8220;columns&#8221; is a String[] of rows.  All my rows are shown with quotes instead of using key_row.</p>
<p>queryString = query.getData(&#8220;data.xml&#8221;, columns, &#8220;_id =&#8221; + id, null, null, null, null, null);</p>
<p>From there you can have am EditText and save it to a String title and query the DB with the string.</p>
<p>In theory lol.</p>
<p>Now, I was wondering how I can input data into my DB outside of an activity.  When I remove the &#8220;extends activity&#8221; from the class it shows error for the line </p>
<p>query = new DatabaseQuery(this);  </p>
<p>I need to have this run from a service that auto downloads and inputs the data every minute without calling an activity.  The service works but when it calls the activity to input data everything else goes to onPause and the input data activity takes focus then closes.  Then the screen flashes and the main activity goes to onResume and refreshes.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.540 seconds -->

