<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" 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/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>The Blogger In Me</title>
	
	<link>http://bloggerinme.wordpress.com</link>
	<description>Starting a Blog</description>
	<lastBuildDate>Fri, 25 May 2012 04:15:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain="bloggerinme.wordpress.com" port="80" path="/?rsscloud=notify" registerProcedure="" protocol="http-post" />
<image><link>http://creativecommons.org/licenses/by/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://bloggerinme.wordpress.com/osd.xml" title="The Blogger In Me" />
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TheBloggerInMe" /><feedburner:info uri="thebloggerinme" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://bloggerinme.wordpress.com/?pushpress=hub" /><creativeCommons:license>http://creativecommons.org/licenses/by/2.0/</creativeCommons:license><item>
		<title>Working with date in SQLite for Android</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/hP-Ek3tSvWE/</link>
		<comments>http://bloggerinme.wordpress.com/2012/03/03/working-with-date-in-sqlite-for-android/#comments</comments>
		<pubDate>Sat, 03 Mar 2012 07:49:11 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Sqlite]]></category>

		<guid isPermaLink="false">https://bloggerinme.wordpress.com/?p=184</guid>
		<description><![CDATA[Working with dates in Oracle for reporting is very easy ( Since Oracle recognizes the date as datatype). But SQLite does not recognize Date as a datatype, this causes an issue when when you have to query for records that fall in between a range in SQLite. &#160; Oracle it is very easy, just use [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=184&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Working with dates in Oracle for reporting is very easy ( Since Oracle recognizes the date as datatype). But SQLite does not recognize Date as a datatype, this causes an issue when when you have to query for records that fall in between a range in SQLite.</p>
<p>&#160;</p>
<p>Oracle it is very easy, just use he to_date command -</p>
<p><strong>Oracle query :</strong></p>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">SELECT amount,purchase_date FROM table_z
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">WHERE purchase_date &gt;= TO_DATE('21-MAY-2011’,’DD-MON-YYYY’)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  AND puchase_date  &lt;  TO_DATE('21-JAN-2012','DD-MON-YYYY');</pre>
<p>In SQLite date needs to be converted into appropriate format before storing it in the database.</p>
<p><font color="#004080">While storing in the database the date can be converted into <strong>YYYYMMDD</strong> format and stored in the database as an integer. Storing in this format in the database will ensure that older dates will have lesser value than the later ones.</font></p>
<blockquote>
<p><font color="#004080">Eg: 21-MAY-2011 will have 20110521<br />
      <br />&#160;&#160;&#160;&#160;&#160; 21-JAN-2012&#160; will have 20120121</font></p>
<p><font color="#004080">The integer 20110521 &lt; 20120121</font></p>
</blockquote>
<p><font color="#004080"></font>So the SQlite equivalent of the query will be</p>
<p><strong>SQLite Query :</strong></p>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">SELECT amount,purchase_date FROM table_z
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">WHERE purchase_date &gt;= 20110521
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  AND puchase_date  &lt;  20120121
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<p>
  </p>
<p>Source: StackOverflow</p>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/computer/android/'>Android</a>, <a href='http://bloggerinme.wordpress.com/category/computer/'>Computer</a>, <a href='http://bloggerinme.wordpress.com/category/computer/java/'>Java</a>, <a href='http://bloggerinme.wordpress.com/category/computer/programming/'>Programming</a>, <a href='http://bloggerinme.wordpress.com/category/computer/software-computer/'>Software</a> Tagged: <a href='http://bloggerinme.wordpress.com/tag/android/'>Android</a>, <a href='http://bloggerinme.wordpress.com/tag/java/'>Java</a>, <a href='http://bloggerinme.wordpress.com/tag/sqlite/'>Sqlite</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/184/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=184&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2012/03/03/working-with-date-in-sqlite-for-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>
	<feedburner:origLink>http://bloggerinme.wordpress.com/2012/03/03/working-with-date-in-sqlite-for-android/</feedburner:origLink></item>
		<item>
		<title>Android Programming – setContentView()</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/UTLu209TcXo/</link>
		<comments>http://bloggerinme.wordpress.com/2011/12/10/android-programming-setcontentview/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 13:28:00 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Problem]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[setContentView()]]></category>

		<guid isPermaLink="false">https://bloggerinme.wordpress.com/?p=181</guid>
		<description><![CDATA[setContentView() is a very important function when it comes to programming with Android. One has to understand its use completely to work with Android UserInterface. Basically what this function does is display the Layout created thorugh XML or the Dynamically created layout view in the Screen. &#160; Syntax - For an XML Layout - setContentView(R.layout.showexcer); [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=181&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>setContentView() is a very important function when it comes to programming with Android.</p>
<p>One has to understand its use completely to work with Android UserInterface.</p>
<p>Basically what this function does is display the Layout created thorugh XML or the Dynamically created layout view in the Screen.</p>
<p>&#160;</p>
<p>Syntax -</p>
<p>For an XML Layout -</p>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">setContentView(R.layout.showexcer);</pre>
<p>where showexcer.xml is your xml file.</p>
<p>For Dynamically created Java View/Layout</p>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">View v1=<span style="color:#0000ff;">new</span> View(<span style="color:#0000ff;">this</span>);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">setContentView(v1);</pre>
<p>Similarly a dynamically created layout can be dispalyed using setContentView();</p>
<ul>
<li>setContentView is amethod of Activity class. So to call you the class should be a subclass of Activity class.</li>
</ul>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/computer/android/'>Android</a>, <a href='http://bloggerinme.wordpress.com/category/computer/'>Computer</a> Tagged: <a href='http://bloggerinme.wordpress.com/tag/android/'>Android</a>, <a href='http://bloggerinme.wordpress.com/tag/computer/'>Computer</a>, <a href='http://bloggerinme.wordpress.com/tag/java/'>Java</a>, <a href='http://bloggerinme.wordpress.com/tag/problem/'>Problem</a>, <a href='http://bloggerinme.wordpress.com/tag/programming/'>Programming</a>, <a href='http://bloggerinme.wordpress.com/tag/setcontentview/'>setContentView()</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/181/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=181&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2011/12/10/android-programming-setcontentview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>
	<feedburner:origLink>http://bloggerinme.wordpress.com/2011/12/10/android-programming-setcontentview/</feedburner:origLink></item>
		<item>
		<title>Android Database Table export to CSV – Part 3</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/QgwHKbjr25M/</link>
		<comments>http://bloggerinme.wordpress.com/2011/12/05/android-database-table-export-to-csv-part-3/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 20:19:24 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">https://bloggerinme.wordpress.com/?p=176</guid>
		<description><![CDATA[I tried out the method mentioned here. Soon I found out that this was not the thing that I needed . I needed the table level data which had the transactional information and not database level data. So CSV was a good option. In Android phones you can view the csv file in an excel [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=176&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I tried out the method mentioned <a href="http://bloggerinme.wordpress.com/2011/12/03/android-database-table-export-to-csv-part-2/">here</a>. Soon I found out that this was not the thing that I needed . </p>
<p>I needed the table level data which had the transactional information and not database level data.</p>
<p>So CSV was a good option.</p>
<p>In Android phones you can view the csv file in an excel format using ThinkFree Office tools. Similarly in PC using MSOffice Excel.</p>
<p>The code structure is similar to the export to DB as used in the <a href="http://bloggerinme.wordpress.com/2011/12/03/android-database-table-export-to-csv-part-2/">previous post</a>, the difference is that we use a thrid-party Java CSV library called OPENCSV.</p>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"><span style="color:#008000;">/*******************************************************************************
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">********************************************************************************
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">Export Database into CSV Class
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">********************************************************************************
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">*******************************************************************************/</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    <span style="color:#0000ff;">class</span> ExportDatabaseCSVTask <span style="color:#0000ff;">extends</span> AsyncTask&lt;String, Void, Boolean&gt; 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">final</span> ProgressDialog dialog = <span style="color:#0000ff;">new</span> ProgressDialog(ctx);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#008000;">// can use UI thread here</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        @Override
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> onPreExecute() 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">this</span>.dialog.setMessage(&quot;<span style="color:#8b0000;">Exporting database...</span>&quot;);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">this</span>.dialog.show();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        }   
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#008000;">// automatically done on worker thread (separate from UI thread)</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">protected</span> Boolean doInBackground(<span style="color:#0000ff;">final</span> String... args) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            File dbFile=getDatabasePath(&quot;<span style="color:#8b0000;">excerDB.db</span>&quot;);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            DbClass DBob = <span style="color:#0000ff;">new</span> DbClass(MainActivity.<span style="color:#0000ff;">this</span>);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            File exportDir = <span style="color:#0000ff;">new</span> File(Environment.getExternalStorageDirectory(), &quot;<span style="color:#8b0000;"></span>&quot;);        
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">if</span> (!exportDir.exists()) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                exportDir.mkdirs();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            File file = <span style="color:#0000ff;">new</span> File(exportDir, &quot;<span style="color:#8b0000;">excerDB.csv</span>&quot;);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">try</span> 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                file.createNewFile();                
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                CSVWriter csvWrite = <span style="color:#0000ff;">new</span> CSVWriter(<span style="color:#0000ff;">new</span> FileWriter(file));
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                SQLiteDatabase db = DBob.getReadableDatabase();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                Cursor curCSV = db.rawQuery(&quot;<span style="color:#8b0000;">SELECT * FROM ExcerTable</span>&quot;,<span style="color:#0000ff;">null</span>);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                csvWrite.writeNext(curCSV.getColumnNames());
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">while</span>(curCSV.moveToNext())
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                    String arrStr[] ={curCSV.getString(0),curCSV.getString(1),
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                        curCSV.getString(2),curCSV.getString(3),curCSV.getString(4)};
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                    csvWrite.writeNext(arrStr);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                csvWrite.close();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                curCSV.close();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">true</span>;
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">catch</span>(SQLException sqlEx)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                Log.e(&quot;<span style="color:#8b0000;">MainActivity</span>&quot;, sqlEx.getMessage(), sqlEx);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;                
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">catch</span> (IOException e) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                Log.e(&quot;<span style="color:#8b0000;">MainActivity</span>&quot;, e.getMessage(), e);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#008000;">// can use UI thread here</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        @Override
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> onPostExecute(<span style="color:#0000ff;">final</span> Boolean success) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">if</span> (<span style="color:#0000ff;">this</span>.dialog.isShowing()) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">this</span>.dialog.dismiss();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">if</span> (success) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                Toast.makeText(ctx, &quot;<span style="color:#8b0000;">Export successful!</span>&quot;, Toast.LENGTH_SHORT).show();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            } 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">else</span> 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                Toast.makeText(ctx, &quot;<span style="color:#8b0000;">Export failed</span>&quot;, Toast.LENGTH_SHORT).show();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    }</pre>
<p>&#160;</p>
<p>This is used with a button Listener as follows -</p>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">Context ctx = MainActivity.<span style="color:#0000ff;">this</span>;
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"><span style="color:#008000;">//Create a Button listener for the CSV Export</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">Button impCSVBtn = (Button) findViewById(R.id.imp_csv_id);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">impCSVBtn.setOnClickListener(<span style="color:#0000ff;">new</span> OnClickListener() {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> onClick(View view)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  <span style="color:#0000ff;">try</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">      <span style="color:#0000ff;">new</span> ExportDatabaseCSVTask().execute(&quot;<span style="color:#8b0000;"></span>&quot;);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  <span style="color:#0000ff;">catch</span>(Exception ex)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">      Log.e(&quot;<span style="color:#8b0000;">Error in MainActivity</span>&quot;,ex.toString());
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">});
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<p>This solved the export data problem for my app. </p>
<p>&#160;</p>
<p>References :</p>
<p><a title="http://stackoverflow.com" href="http://stackoverflow.com">http://stackoverflow.com</a> ( No specific question but after reading the responses for similar questions I came up with this ).</p>
<p>&#160;</p>
<p>Related Reading :</p>
<h4><a href="http://bloggerinme.wordpress.com/2011/11/29/android-database-table-export-to-csv-part-1/">Android Database Table export to CSV – Part 1</a></h4>
<h4><a href="http://bloggerinme.wordpress.com/2011/12/03/android-database-table-export-to-csv-part-2/">Android Database Table export to CSV – Part 2</a></h4>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/computer/android/'>Android</a>, <a href='http://bloggerinme.wordpress.com/category/computer/'>Computer</a>, <a href='http://bloggerinme.wordpress.com/category/computer/java/'>Java</a>, <a href='http://bloggerinme.wordpress.com/category/computer/programming/'>Programming</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/176/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=176&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2011/12/05/android-database-table-export-to-csv-part-3/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>
	<feedburner:origLink>http://bloggerinme.wordpress.com/2011/12/05/android-database-table-export-to-csv-part-3/</feedburner:origLink></item>
		<item>
		<title>Android Database Table export to CSV – Part 2</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/MNkxS2anbYM/</link>
		<comments>http://bloggerinme.wordpress.com/2011/12/03/android-database-table-export-to-csv-part-2/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 06:31:38 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">https://bloggerinme.wordpress.com/?p=172</guid>
		<description><![CDATA[Copy the Android database into DB File - This is the easier of the two methods. I put a search in Google and found many queries and resolution for this. Basically what we do here is the SQLite Database creates .db file. this db file is copied as it is as a backup. We can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=172&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Copy the Android database into DB File -</h3>
<ul>
<li>This is the easier of the two methods. I put a search in Google and found many queries and resolution for this. </li>
<li>Basically what we do here is the SQLite Database creates .db file. this db file is copied as it is as a backup. We can use external SQLite readers in our PC to access the data. </li>
<li>Code : </li>
</ul>
<p>We create an class that extends AsyncTask so that export is handled in a thread.</p>
</p>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"><span style="color:#008000;">/*******************************************************************************
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">********************************************************************************
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">Export Database into file Class
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">********************************************************************************
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">*******************************************************************************/</span>    
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    <span style="color:#0000ff;">class</span> ExportDatabaseFileTask <span style="color:#0000ff;">extends</span> AsyncTask&lt;String, Void, Boolean&gt; 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">final</span> ProgressDialog dialog = <span style="color:#0000ff;">new</span> ProgressDialog(ctx);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#008000;">// can use UI thread here</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        @Override
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> onPreExecute() 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">this</span>.dialog.setMessage(&quot;<span style="color:#8b0000;">Exporting database...</span>&quot;);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">this</span>.dialog.show();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        }   
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#008000;">// automatically done on worker thread (separate from UI thread)</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">protected</span> Boolean doInBackground(<span style="color:#0000ff;">final</span> String... args) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            File dbFile = <span style="color:#0000ff;">new</span> File(Environment.getDataDirectory() + 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                    &quot;<span style="color:#8b0000;">/data/org.test.xyz/databases/excerDB.db</span>&quot;);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            File exportDir = <span style="color:#0000ff;">new</span> File(Environment.getExternalStorageDirectory(), &quot;<span style="color:#8b0000;"></span>&quot;);        
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">if</span> (!exportDir.exists()) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                exportDir.mkdirs();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            File file = <span style="color:#0000ff;">new</span> File(exportDir, dbFile.getName());
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">try</span> 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                file.createNewFile();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">this</span>.copyFile(dbFile, file);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">true</span>;
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            } 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">catch</span> (IOException e) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                Log.e(&quot;<span style="color:#8b0000;">mypck</span>&quot;, e.getMessage(), e);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#008000;">// can use UI thread here</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        @Override
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> onPostExecute(<span style="color:#0000ff;">final</span> Boolean success) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">if</span> (<span style="color:#0000ff;">this</span>.dialog.isShowing()) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">this</span>.dialog.dismiss();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">if</span> (success) 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                Toast.makeText(ctx, &quot;<span style="color:#8b0000;">Export successful!</span>&quot;, Toast.LENGTH_SHORT).show();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            } 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">else</span> 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                Toast.makeText(ctx, &quot;<span style="color:#8b0000;">Export failed</span>&quot;, Toast.LENGTH_SHORT).show();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">void</span> copyFile(File src, File dst) <span style="color:#0000ff;">throws</span> IOException 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            FileChannel inChannel = <span style="color:#0000ff;">new</span> FileInputStream(src).getChannel();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            FileChannel outChannel = <span style="color:#0000ff;">new</span> FileOutputStream(dst).getChannel();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">try</span> 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                inChannel.transferTo(0, inChannel.size(), outChannel);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            } 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">finally</span> 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">if</span> (inChannel != <span style="color:#0000ff;">null</span>)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                    inChannel.close();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                <span style="color:#0000ff;">if</span> (outChannel != <span style="color:#0000ff;">null</span>)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">                    outChannel.close();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    }</pre>
<p>This function is called in the OnClick Button event</p>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">Context ctx = MainActivity.<span style="color:#0000ff;">this</span>; 
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"><span style="color:#008000;">//Create a Button Listener for Export database</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">Button impDBBtn = (Button) findViewById(R.id.imp_db_id);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">impDBBtn.setOnClickListener(<span style="color:#0000ff;">new</span> OnClickListener() {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> onClick(View view)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  <span style="color:#0000ff;">try</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">      <span style="color:#0000ff;">new</span> ExportDatabaseFileTask().execute(&quot;<span style="color:#8b0000;"></span>&quot;);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  <span style="color:#0000ff;">catch</span>(Exception ex)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">      Log.e(&quot;<span style="color:#8b0000;">Error in MainActivity</span>&quot;,ex.toString());
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">  }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    }            
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">});
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"><span style="color:#008000;">//Export Database into file Class</span></pre>
<p>This is a very easy way of creating the backup of your App Data. But the diadvantage is that we need external database viewer to read the data.</p>
<p>If the data needs to be viewed then we need to use CSV Format which can be easily opened through Microsoft Excel.</p>
<p>References </p>
<p><a href="http://stackoverflow.com/questions/4180083/using-a-button-to-export-sqlite-db-to-an-excel-readable-file-perhaps-csv">StackOverFlow</a></p>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/computer/android/'>Android</a>, <a href='http://bloggerinme.wordpress.com/category/computer/'>Computer</a>, <a href='http://bloggerinme.wordpress.com/category/computer/java/'>Java</a>, <a href='http://bloggerinme.wordpress.com/category/computer/programming/'>Programming</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/172/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=172&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2011/12/03/android-database-table-export-to-csv-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>
	<feedburner:origLink>http://bloggerinme.wordpress.com/2011/12/03/android-database-table-export-to-csv-part-2/</feedburner:origLink></item>
		<item>
		<title>Android Database Table export to CSV – Part 1</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/SYHdQ3vz4s4/</link>
		<comments>http://bloggerinme.wordpress.com/2011/11/29/android-database-table-export-to-csv-part-1/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 19:17:00 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[Export]]></category>

		<guid isPermaLink="false">https://bloggerinme.wordpress.com/?p=170</guid>
		<description><![CDATA[The best way to export data out of Android Sqlite database is create a copy the DB file into the SDCard. Copy the Android database into DB File - Advantages - The import and export of the database would be a lot easy. All tables could be backed up using a single file. ( This [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=170&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The best way to export data out of Android Sqlite database is create a copy the DB file into the SDCard.</p>
<h3><strong>Copy the Android database into DB File -</strong></h3>
<p>Advantages -</p>
<ul>
<li>The import and export of the database would be a lot easy.</li>
<li>All tables could be backed up using a single file. ( This can have the backup of the user defined configuration of the program also ).</li>
</ul>
<p>Disadvantages -</p>
<ul>
<li>We need special tools to read this DB file which makes it difficult to be portable.</li>
</ul>
<h3><strong>Copy a table into CSV file -</strong></h3>
<p>Advantages -</p>
<ul>
<li>Only data required by the user can be given.</li>
<li>It is the more readable and portable format.</li>
</ul>
<p>In my application I have decided to have both this methods. Will be updating soon.</p>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/computer/android/'>Android</a>, <a href='http://bloggerinme.wordpress.com/category/computer/'>Computer</a>, <a href='http://bloggerinme.wordpress.com/category/computer/java/'>Java</a>, <a href='http://bloggerinme.wordpress.com/category/computer/programming/'>Programming</a> Tagged: <a href='http://bloggerinme.wordpress.com/tag/android/'>Android</a>, <a href='http://bloggerinme.wordpress.com/tag/computer/'>Computer</a>, <a href='http://bloggerinme.wordpress.com/tag/csv/'>CSV</a>, <a href='http://bloggerinme.wordpress.com/tag/export/'>Export</a>, <a href='http://bloggerinme.wordpress.com/tag/java/'>Java</a>, <a href='http://bloggerinme.wordpress.com/tag/programming/'>Programming</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=170&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2011/11/29/android-database-table-export-to-csv-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>
	<feedburner:origLink>http://bloggerinme.wordpress.com/2011/11/29/android-database-table-export-to-csv-part-1/</feedburner:origLink></item>
		<item>
		<title>Create a Alert Dialog in Android</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/xd5dDhKLmnk/</link>
		<comments>http://bloggerinme.wordpress.com/2011/11/21/create-a-alert-dialog-in-android/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 15:43:09 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[Dialog]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">https://bloggerinme.wordpress.com/?p=162</guid>
		<description><![CDATA[Dialogs are generally used to display the the intermediate data like Status Messages, Warning Messages or Error Messages. In this post we will go through how to create a Dialog Box in Android App development - Create a function will call the Alert Dialog (AddEx is the activity. You can use your activity name over [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=162&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Dialogs are generally used to display the the intermediate data like Status Messages, Warning Messages or Error Messages.</p>
<p>In this post we will go through how to create a Dialog Box in Android App development -</p>
<ul>
<li>Create a function will call the Alert Dialog (AddEx is the activity. You can use your activity name over here ).</li>
</ul>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;width:650px;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  1: <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">void</span> displayDialog(String str1)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  2: {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  3:   AlertDialog.Builder builder = <span style="color:#0000ff;">new</span> AlertDialog.Builder(AddEx.<span style="color:#0000ff;">this</span>);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  4:   builder.setMessage(str1);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  5:   builder.setCancelable(<span style="color:#0000ff;">false</span>);
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  6:   builder.setTitle("<span style="color:#8b0000;">Status</span>");
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  7:   builder.setPositiveButton("<span style="color:#8b0000;">OK</span>", <span style="color:#0000ff;">new</span> DialogInterface.OnClickListener() {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  8:          @Override
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  9:          <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> onClick(DialogInterface dialog, <span style="color:#0000ff;">int</span> id) {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;"> 10:           AddEx.<span style="color:#0000ff;">this</span>.finish();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;"> 11:          }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;"> 12:        });
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;"> 13:   AlertDialog alert = builder.create();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;"> 14:   alert.show();
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;"> 15: }</pre>
<pre class="prettyprint"></pre>
</p>
<ul>
<li>Call this function anywhere in your activity class.</li>
</ul>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  1:  <span style="color:#0000ff;">if</span>(status == <span style="color:#0000ff;">true</span>)
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  2:  {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  3:   displayDialog("<span style="color:#8b0000;">Completed Successfully</span>");
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  4:  }
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  5:  <span style="color:#0000ff;">else</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  6:  {
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  7:    displayDialog("<span style="color:#8b0000;">Error inserting into Table</span>");
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,'Courier New',courier,monospace;background-color:#fbfbfb;margin:0;">  8:  }</pre>
<ul>
<li>In the Alert Dialog you can also implement builder.setNegativebutton() method to have “CANCEL” part included in the dialog. Implementation is similar to setPositiveButton.</li>
</ul>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/computer/'>Computer</a>, <a href='http://bloggerinme.wordpress.com/category/computer/programming/'>Programming</a>, <a href='http://bloggerinme.wordpress.com/category/computer/software-computer/'>Software</a> Tagged: <a href='http://bloggerinme.wordpress.com/tag/android/'>Android</a>, <a href='http://bloggerinme.wordpress.com/tag/create/'>create</a>, <a href='http://bloggerinme.wordpress.com/tag/dialog/'>Dialog</a>, <a href='http://bloggerinme.wordpress.com/tag/java/'>Java</a>, <a href='http://bloggerinme.wordpress.com/tag/programming/'>Programming</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/162/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=162&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2011/11/21/create-a-alert-dialog-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>
	<feedburner:origLink>http://bloggerinme.wordpress.com/2011/11/21/create-a-alert-dialog-in-android/</feedburner:origLink></item>
		<item>
		<title>How to compile JAVA Project into a single JAR File using NetBeans</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/Sj0E84hHUxU/</link>
		<comments>http://bloggerinme.wordpress.com/2011/11/03/how-to-compile-java-project-into-a-single-jar-file-using-netbeans/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 15:32:00 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">https://bloggerinme.wordpress.com/2011/11/03/how-to-compile-java-project-into-a-single-jar-file-using-netbeans/</guid>
		<description><![CDATA[I found an interesting article about compiling a NetBeans project into a single JAR file. &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;project name=&#34;build-OneJar1&#34; default=&#34;all&#34; basedir=&#34;..&#34;&#62; &#60;target name=&#34;package-for-store&#34; depends=&#34;jar&#34;&#62; &#60;!– Change the value of this property to be the name of your JAR, minus the .jar extension. It should not have spaces. &#60;property name=&#34;store.jar.name&#34; value=&#34;MyJarName&#34;/&#62; –&#62; &#60;property name=&#34;store.jar.name&#34; value=&#34;MyProject&#34;/&#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=161&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="csharpcode-wrapper" id="codeSnippetWrapper">
<div class="csharpcode" id="codeSnippet">I found an interesting article about compiling a NetBeans project into a single JAR file.</div>
</p></div>
<pre style="border-right:#cecece 1px solid;border-top:#cecece 1px solid;min-height:40px;overflow:auto;border-left:#cecece 1px solid;border-bottom:#cecece 1px solid;background-color:#fbfbfb;padding:5px;"><pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"><span style="color:#0000ff;">&lt;?</span>xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;<span style="color:#0000ff;">?&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">project</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">&quot;build-OneJar1&quot;</span> <span style="color:#ff0000;">default</span>=<span style="color:#0000ff;">&quot;all&quot;</span> <span style="color:#ff0000;">basedir</span>=<span style="color:#0000ff;">&quot;..&quot;</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">   <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">target</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">&quot;package-for-store&quot;</span> <span style="color:#ff0000;">depends</span>=<span style="color:#0000ff;">&quot;jar&quot;</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">&lt;</span>!– Change the value of this property to be the name of your JAR,
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">             minus the .jar extension. It should not have spaces.
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">             <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">property</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">&quot;store.jar.name&quot;</span> <span style="color:#ff0000;">value</span>=<span style="color:#0000ff;">&quot;MyJarName&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">        –&gt;
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">property</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">&quot;store.jar.name&quot;</span> <span style="color:#ff0000;">value</span>=<span style="color:#0000ff;">&quot;MyProject&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">&lt;</span>!– don’t edit below this line –<span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">property</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">&quot;store.dir&quot;</span> <span style="color:#ff0000;">value</span>=<span style="color:#0000ff;">&quot;store&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">        <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">property</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">&quot;store.jar&quot;</span> <span style="color:#ff0000;">value</span>=<span style="color:#0000ff;">&quot;${store.dir}/${store.jar.name}.jar&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">        <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">echo</span> <span style="color:#ff0000;">message</span>=<span style="color:#0000ff;">&quot;Packaging ${application.title} into a single JAR at ${store.jar}&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">        <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">delete</span> <span style="color:#ff0000;">dir</span>=<span style="color:#0000ff;">&quot;${store.dir}&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">mkdir</span> <span style="color:#ff0000;">dir</span>=<span style="color:#0000ff;">&quot;${store.dir}&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">jar</span> <span style="color:#ff0000;">destfile</span>=<span style="color:#0000ff;">&quot;${store.dir}/temp_final.jar&quot;</span> <span style="color:#ff0000;">filesetmanifest</span>=<span style="color:#0000ff;">&quot;skip&quot;</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">            <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">zipgroupfileset</span> <span style="color:#ff0000;">dir</span>=<span style="color:#0000ff;">&quot;dist&quot;</span> <span style="color:#ff0000;">includes</span>=<span style="color:#0000ff;">&quot;*.jar&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">zipgroupfileset</span> <span style="color:#ff0000;">dir</span>=<span style="color:#0000ff;">&quot;dist/lib&quot;</span> <span style="color:#ff0000;">includes</span>=<span style="color:#0000ff;">&quot;*.jar&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">manifest</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">                <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">attribute</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">&quot;Main-Class&quot;</span> <span style="color:#ff0000;">value</span>=<span style="color:#0000ff;">&quot;${main.class}&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">manifest</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">        <span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">jar</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">        <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">zip</span> <span style="color:#ff0000;">destfile</span>=<span style="color:#0000ff;">&quot;${store.jar}&quot;</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">            <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">zipfileset</span> <span style="color:#ff0000;">src</span>=<span style="color:#0000ff;">&quot;${store.dir}/temp_final.jar&quot;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;">            <span style="color:#ff0000;">excludes</span>=<span style="color:#0000ff;">&quot;META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">zip</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">        <span style="color:#0000ff;">&lt;</span><span style="color:#800000;">delete</span> <span style="color:#ff0000;">file</span>=<span style="color:#0000ff;">&quot;${store.dir}/temp_final.jar&quot;</span><span style="color:#0000ff;">/&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;"></pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#fbfbfb;margin:0;">    <span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">target</span><span style="color:#0000ff;">&gt;</span>
</pre>
<pre style="font-size:12px;width:100%;font-family:consolas,&#039;background-color:#ffffff;margin:0;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">project</span><span style="color:#0000ff;">&gt;</span></pre>
<ul>
<li>Save the above code as build-OneJar.xml and save it in the NetBeans project folder.( I saved in the nbproject folder and also had the file as a ANT project file.). </li>
</ul>
<p><a href="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11202929001.png"><img height="323" src="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11202929001.png" width="455" /></a> </p>
<ul>
<li>In Build.xml put an import statement and import the build-onejar.xml file. </li>
</ul>
<p><a href="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11203529001.png"><img height="322" src="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11203529001.png" width="460" /></a> </p>
<ul>
<li>To build the NetBeans project into a single JAR file, it needs to be run using the specified parameters as TARGET. To do this Right Click build.xml in the Files TAB and select <strong>Run Target –&gt; Other Targets –&gt; Package-For-Store.</strong> </li>
</ul>
<p><a href="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11205211001.png"><img height="322" src="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11205211001.png" width="460" /></a> </p>
<ul>
<li>The JAR file will be built and stored in a folder called <strong>Store</strong> in the </li>
<li>Also remember to save the <strong>build-onejar.xml</strong> file as a template for future use. To do this go right click on the file in the Files TAB and select Save As Template….. select the appropriate folder and click OK. </li>
</ul>
<p><a href="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11204416001.png"><img height="322" src="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11204416001.png" width="460" /></a> </p>
<p>&#160;</p>
<p>&#160; In this way a NetBeans project can be compiled into a single JAR file.</p>
</p>
<p><strong>Sources</strong></p>
<p><a title="http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/" href="http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/">http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/</a></p>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/computer/'>Computer</a>, <a href='http://bloggerinme.wordpress.com/category/computer/programming/'>Programming</a>, <a href='http://bloggerinme.wordpress.com/category/computer/software-computer/'>Software</a> Tagged: <a href='http://bloggerinme.wordpress.com/tag/java/'>Java</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/161/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=161&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2011/11/03/how-to-compile-java-project-into-a-single-jar-file-using-netbeans/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>

		<media:content url="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11202929001.png" medium="image" />

		<media:content url="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11203529001.png" medium="image" />

		<media:content url="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11205211001.png" medium="image" />

		<media:content url="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-03-11204416001.png" medium="image" />
	<feedburner:origLink>http://bloggerinme.wordpress.com/2011/11/03/how-to-compile-java-project-into-a-single-jar-file-using-netbeans/</feedburner:origLink></item>
		<item>
		<title>How to use SQLite with Java using NetBeans IDE</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/ZtcDA-Drgsg/</link>
		<comments>http://bloggerinme.wordpress.com/2011/11/02/how-to-use-sqlite-with-java-using-netbeans-ide/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 17:17:19 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Sqlite]]></category>

		<guid isPermaLink="false">https://bloggerinme.wordpress.com/2011/11/02/how-to-use-sqlite-with-java-using-netbeans-ide/</guid>
		<description><![CDATA[SQLite is an embedded database which will have all the tables stored in a db file. This saves the trouble of having to setup database servers everytime we develop a new programs. Android uses SQLite as a database. I was browsing through the net on how to use SQLite for a small app I was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=158&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<ul>
<li>SQLite is an embedded database which will have all the tables stored in a db file. This saves the trouble of having to setup database servers everytime we develop a new programs. Android uses SQLite as a database. </li>
<li>I was browsing through the net on how to use SQLite for a small app I was developing. I came across <a href="http://tech-britney.blogspot.com/2010/07/using-sqlite-with-sqlitejdbc-driver.html">this page</a> which had very good directions on how to use SQLite with Java. </li>
</ul>
<blockquote><p>1. SQLite is serverless. With SQLiteJDBC driver, we can write programs to access SQLite using JAVA.      <br />This tutorial will have step by step description about how to do it.       <br />2. We will use Netbeans, but it will work in the same manner with eclipse too.       <br />3. Download SQLiteJDBC driver jar, &#8216;sqlitejdbc-v056.jar&#8217; from website: http://www.zentus.com/sqlitejdbc/       <br />4. Create a java project named &#8216;SQLite&#8217; in Netbeans.(You can give any name       <br />5. Create a class called &#8216;Test&#8217; in that project.       <br />6. Add &#8216;sqlitejdbc-v056.jar&#8217; in the class path of &#8216;SQLite&#8217; project in Netbeans.       <br />7. Paste following code in Test class       <br />&#8212;&gt;       <br />import java.sql.*;       <br />public class Test {       <br />public static void main(String[] args) throws Exception {       <br />Class.forName(&quot;org.sqlite.JDBC&quot;);       <br />Connection conn =       <br />DriverManager.getConnection(&quot;jdbc:sqlite:Vinit&quot;);       <br />Statement stat = conn.createStatement();       <br />stat.executeUpdate(&quot;drop table if exists school;&quot;);       <br />stat.executeUpdate(&quot;create table school (name, state);&quot;);       <br />PreparedStatement prep = conn.prepareStatement(       <br />&quot;insert into school values (?, ?);&quot;);       <br />prep.setString(1, &quot;UTD&quot;);       <br />prep.setString(2, &quot;texas&quot;);       <br />prep.addBatch();       <br />prep.setString(1, &quot;USC&quot;);       <br />prep.setString(2, &quot;california&quot;);       <br />prep.addBatch();       <br />prep.setString(1, &quot;MIT&quot;);       <br />prep.setString(2, &quot;massachusetts&quot;);       <br />prep.addBatch();       <br />conn.setAutoCommit(false);       <br />prep.executeBatch();       <br />conn.setAutoCommit(true);       <br />ResultSet rs = stat.executeQuery(&quot;select * from school;&quot;);       <br />while (rs.next()) {       <br />System.out.print(&quot;Name of School = &quot; + rs.getString(&quot;name&quot;) + &quot; &quot;);       <br />System.out.println(&quot;state = &quot; + rs.getString(&quot;state&quot;));       <br />}       <br />rs.close();       <br />conn.close();       <br />}       <br />}       <br />&#8212;&gt;       <br />8. Run the project as java application.       <br />9. It will create database file by name &#8216;Vinit&#8217; in the Netbeans &#8216;SQLite&#8217; project folder.       <br />10. Here is in above code, we are creating sqlite database &#8216;Vinit&#8217;.</p>
</blockquote>
<ul>
<li>In NetBeans add libraries by going to Tools –&gt; Libraries and Click ADD LIBRARY. An Add Library dialog will appear </li>
</ul>
<p><a href="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11193826001.png"><img height="376" src="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11193826001.png" width="480" /></a> </p>
<ul>
<li>Add the driver JAR file location into CLASSPATH tab </li>
</ul>
<p><a href="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11193917001.png"><img style="display:inline;margin-left:0;margin-right:0;" height="381" src="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11193917001.png" width="480" /></a> </p>
<ul>
<li>In the Projects window Right Click on Libraries folder and Select <strong>Add Library</strong>…<a href="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11194020001.png"><img height="452" src="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11194020001.png" width="480" /></a> </li>
</ul>
<p>Click on Add Library and select Sqlite3.</p>
<p><a href="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11194134001.png"><img height="342" src="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11194134001.png" width="480" /></a> </p>
<p>Sources:</p>
<p><a title="http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite/Connecting" href="http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite/Connecting">http://en.wikibooks.org/wiki/Java_JDBC_using_SQLite/Connecting</a></p>
<p><a title="http://tech-britney.blogspot.com/2010/07/using-sqlite-with-sqlitejdbc-driver.html" href="http://tech-britney.blogspot.com/2010/07/using-sqlite-with-sqlitejdbc-driver.html">http://tech-britney.blogspot.com/2010/07/using-sqlite-with-sqlitejdbc-driver.html</a></p>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/computer/'>Computer</a>, <a href='http://bloggerinme.wordpress.com/category/computer/programming/'>Programming</a>, <a href='http://bloggerinme.wordpress.com/category/computer/software-computer/'>Software</a> Tagged: <a href='http://bloggerinme.wordpress.com/tag/java/'>Java</a>, <a href='http://bloggerinme.wordpress.com/tag/sqlite/'>Sqlite</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/158/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=158&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2011/11/02/how-to-use-sqlite-with-java-using-netbeans-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>

		<media:content url="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11193826001.png" medium="image" />

		<media:content url="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11193917001.png" medium="image" />

		<media:content url="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11194020001.png" medium="image" />

		<media:content url="http://i266.photobucket.com/albums/ii280/batta420/Screenshot11-02-11194134001.png" medium="image" />
	<feedburner:origLink>http://bloggerinme.wordpress.com/2011/11/02/how-to-use-sqlite-with-java-using-netbeans-ide/</feedburner:origLink></item>
		<item>
		<title>Final Year Projects</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/cWqHUv5ORPc/</link>
		<comments>http://bloggerinme.wordpress.com/2010/03/01/final-year-projects/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 17:00:13 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://bloggerinme.wordpress.com/2010/03/01/final-year-projects/</guid>
		<description><![CDATA[Finally after 4 years of struggle and hard work( ??? ), finally engineering studies is going to end in 3 months. But wait…. to complete it we all have to complete a project where we are supposed to apply all that we had studied in the past 4 years come out with some good projects. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=152&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Finally after 4 years of struggle and hard work( ??? ), finally engineering studies is going to end in 3 months. But wait…. to complete it we all have to complete a project where we are supposed to apply all that we had studied in the past 4 years come out with some good projects. Well one month already passed and I’ve not started anything yet. Hope I get it done soon…..</p>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/personal/'>personal</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=152&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2010/03/01/final-year-projects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>
	<feedburner:origLink>http://bloggerinme.wordpress.com/2010/03/01/final-year-projects/</feedburner:origLink></item>
		<item>
		<title>Placed in Infosys</title>
		<link>http://feedproxy.google.com/~r/TheBloggerInMe/~3/xx4TQoE_U0s/</link>
		<comments>http://bloggerinme.wordpress.com/2010/03/01/placed-in-infosys/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 20:09:32 +0000</pubDate>
		<dc:creator>batta420</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[Campus]]></category>
		<category><![CDATA[Infosys]]></category>
		<category><![CDATA[Placement]]></category>

		<guid isPermaLink="false">http://bloggerinme.wordpress.com/2010/03/01/placed-in-infosys/</guid>
		<description><![CDATA[I got placed in Infosys last week. It was through the Campus recruitment in our College. We had first Aptitude Round and then HR interview. It was actually a cool thing because I was not expecting to get placed in the company and I guess I really did surprise myself!!!! Now the classes seem very [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=150&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I got placed in Infosys last week. It was through the Campus recruitment in our College. We had first Aptitude Round and then HR interview. It was actually a cool thing because I was not expecting to get placed in the company and I guess I really did surprise myself!!!! Now the classes seem very boring since after doing 4 years of Engineering in Electronics And Communication , I am going to leave this field anyway to join the software industry. So started writing this blog again. Hope I’ll be writing for sometime ( Not that anyone cares). Still I guess I like to imagine myself heard by lot of people.</p>
<p>Will be writing again soon….</p>
<br />Filed under: <a href='http://bloggerinme.wordpress.com/category/personal/'>personal</a> Tagged: <a href='http://bloggerinme.wordpress.com/tag/campus/'>Campus</a>, <a href='http://bloggerinme.wordpress.com/tag/infosys/'>Infosys</a>, <a href='http://bloggerinme.wordpress.com/tag/placement/'>Placement</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bloggerinme.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bloggerinme.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bloggerinme.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bloggerinme.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bloggerinme.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bloggerinme.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bloggerinme.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bloggerinme.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bloggerinme.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bloggerinme.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bloggerinme.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bloggerinme.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bloggerinme.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bloggerinme.wordpress.com/150/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bloggerinme.wordpress.com&#038;blog=3167784&#038;post=150&#038;subd=bloggerinme&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bloggerinme.wordpress.com/2010/03/01/placed-in-infosys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">batta420</media:title>
		</media:content>
	<feedburner:origLink>http://bloggerinme.wordpress.com/2010/03/01/placed-in-infosys/</feedburner:origLink></item>
	</channel>
</rss>

