<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Basics of Android : Part IV &#8211; Android Content Providers</title>
	<atom:link href="http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/</link>
	<description>Tutorials, Tips and tricks, Tools for Android development</description>
	<lastBuildDate>Mon, 30 Jan 2012 19:28:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Sanjeev</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-627</link>
		<dc:creator>Sanjeev</dc:creator>
		<pubDate>Wed, 17 Aug 2011 09:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-627</guid>
		<description>private: restricted to class only. so if u have requirement not to expose ur attributes to other class go for private.
Public : global to all i.e any class from anywhere can access this attribute</description>
		<content:encoded><![CDATA[<p>private: restricted to class only. so if u have requirement not to expose ur attributes to other class go for private.<br />
Public : global to all i.e any class from anywhere can access this attribute</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Prajeev9999</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-610</link>
		<dc:creator>Prajeev9999</dc:creator>
		<pubDate>Wed, 22 Jun 2011 05:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-610</guid>
		<description>In the main (class) we can use the public and Private is the local n Global Variable....</description>
		<content:encoded><![CDATA[<p>In the main (class) we can use the public and Private is the local n Global Variable&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aditya</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-601</link>
		<dc:creator>Aditya</dc:creator>
		<pubDate>Tue, 24 May 2011 09:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-601</guid>
		<description>An awesome tutorial. But could anyone help me with when to use private and when to use public ?</description>
		<content:encoded><![CDATA[<p>An awesome tutorial. But could anyone help me with when to use private and when to use public ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SI</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-588</link>
		<dc:creator>SI</dc:creator>
		<pubDate>Sat, 26 Mar 2011 04:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-588</guid>
		<description>Thanks very much its work work,in the above sample You updated the name ,but I want to update number and here is my code

	private void updateRecord(int recNo, String name) {
		// appending recNo, record to be updated
		
		ContentValues values = new ContentValues();
		Uri numberUri = Uri.withAppendedPath(uri,
				People.Phones.CONTENT_DIRECTORY);
		values.clear();
		values.put(Contacts.Phones.TYPE, People.Phones.TYPE_MOBILE);
		values.put(People.NUMBER, &quot;123456789&quot;);
		int row = getContentResolver().update(numberUri, values, null, null);
		Toast.makeText(this, row + &quot; &quot; + row, Toast.LENGTH_LONG).show();
	}
The row always return 0 value.
I want to know how to update number.
Please  help me .I have already spent on this problem ,very long time.
I am waiting to Your answer.
</description>
		<content:encoded><![CDATA[<p>Thanks very much its work work,in the above sample You updated the name ,but I want to update number and here is my code</p>
<p>	private void updateRecord(int recNo, String name) {<br />
		// appending recNo, record to be updated</p>
<p>		ContentValues values = new ContentValues();<br />
		Uri numberUri = Uri.withAppendedPath(uri,<br />
				People.Phones.CONTENT_DIRECTORY);<br />
		values.clear();<br />
		values.put(Contacts.Phones.TYPE, People.Phones.TYPE_MOBILE);<br />
		values.put(People.NUMBER, &#8220;123456789&#8243;);<br />
		int row = getContentResolver().update(numberUri, values, null, null);<br />
		Toast.makeText(this, row + &#8221; &#8221; + row, Toast.LENGTH_LONG).show();<br />
	}<br />
The row always return 0 value.<br />
I want to know how to update number.<br />
Please  help me .I have already spent on this problem ,very long time.<br />
I am waiting to Your answer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gshoen</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-572</link>
		<dc:creator>Gshoen</dc:creator>
		<pubDate>Thu, 03 Feb 2011 17:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-572</guid>
		<description>Thank you very much for your time and consideration in clarifying such important subject.</description>
		<content:encoded><![CDATA[<p>Thank you very much for your time and consideration in clarifying such important subject.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jen</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-571</link>
		<dc:creator>jen</dc:creator>
		<pubDate>Thu, 03 Feb 2011 02:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-571</guid>
		<description>thank you very much for knowing actually what is content provider and what it does to me. once again thank you very much.</description>
		<content:encoded><![CDATA[<p>thank you very much for knowing actually what is content provider and what it does to me. once again thank you very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: amar</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-550</link>
		<dc:creator>amar</dc:creator>
		<pubDate>Fri, 10 Dec 2010 14:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-550</guid>
		<description>nice 
Amar Nath Poddar</description>
		<content:encoded><![CDATA[<p>nice<br />
Amar Nath Poddar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Supermario</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-541</link>
		<dc:creator>Supermario</dc:creator>
		<pubDate>Thu, 18 Nov 2010 23:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-541</guid>
		<description>Thanks a million, you&#039;ve enlighten me with some aspects here!</description>
		<content:encoded><![CDATA[<p>Thanks a million, you&#8217;ve enlighten me with some aspects here!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ozman Khaled</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-535</link>
		<dc:creator>ozman Khaled</dc:creator>
		<pubDate>Sat, 13 Nov 2010 06:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-535</guid>
		<description>I have an issue regarding creating db on sd card. the following code just creats a db file on sd card but no tables inside that file. please help me
public class DBAdapter 
{
    public static final String KEY_ROWID = &quot;_id&quot;;
    public static final String KEY_ISBN = &quot;isbn&quot;;
    public static final String KEY_TITLE = &quot;title&quot;;
    public static final String KEY_PUBLISHER = &quot;publisher&quot;;    
    private static final String TAG = &quot;DBAdapter&quot;;
    
    private static final String DATABASE_NAME = &quot;books&quot;;
    private static final String DATABASE_TABLE = &quot;titles&quot;;
    private static final int DATABASE_VERSION = 1;

    private static final String DATABASE_CREATE =
        &quot;create table titles (_id integer primary key autoincrement, &quot;
        + &quot;isbn text not null, title text not null, &quot; 
        + &quot;publisher text not null);&quot;;
        
    private final Context context; 
//    public File dbfile = new File(&quot;/sdcard/mydb.db&quot; ); 
    
    private DatabaseHelper DBHelper;
    private SQLiteDatabase db;

    public DBAdapter(Context ctx) 
    {
        this.context = ctx;
        DBHelper = new DatabaseHelper(context);
 
        SQLiteDatabase.openOrCreateDatabase(&quot;/sdcard/rapidandroid/mydb2.db&quot;, null);
    }
   
        
    private static class DatabaseHelper extends SQLiteOpenHelper 
    {
        DatabaseHelper(Context context) 
        {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) 
        {
            db.execSQL(DATABASE_CREATE);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, 
        int newVersion) 
        {
            Log.w(TAG, &quot;Upgrading database from version &quot; + oldVersion 
                    + &quot; to &quot;
                    + newVersion + &quot;, which will destroy all old data&quot;);
            db.execSQL(&quot;DROP TABLE IF EXISTS titles&quot;);
            onCreate(db);
        }
    } 
    
   
    //---opens the database---
    public DBAdapter open() throws SQLException 
    {
 
    	db=SQLiteDatabase.openOrCreateDatabase(&quot;/sdcard/rapidandroid/mydb2.db&quot;, null);
 
    	
    
        return this;
    }
   

    //---closes the database---    
    public void close() 
    {
        DBHelper.close();
    }
    
    //---insert a title into the database---
    public long insertTitle(String isbn, String title, String publisher) 
    {
        ContentValues initialValues = new ContentValues();
        initialValues.put(KEY_ISBN, isbn);
        initialValues.put(KEY_TITLE, title);
        initialValues.put(KEY_PUBLISHER, publisher);
        return db.insert(DATABASE_TABLE, null, initialValues);
    }

    //---deletes a particular title---
    public boolean deleteTitle(long rowId) 
    {
        return db.delete(DATABASE_TABLE, KEY_ROWID + 
        		&quot;=&quot; + rowId, null) &gt; 0;
    }

    //---retrieves all the titles---
    public Cursor getAllTitles() 
    {
        return db.query(DATABASE_TABLE, new String[] {
        		KEY_ROWID, 
        		KEY_ISBN,
        		KEY_TITLE,
                KEY_PUBLISHER}, 
                null, 
                null, 
                null, 
                null, 
                null);
    }

    //---retrieves a particular title---
    public Cursor getTitle(long rowId) throws SQLException 
    {
        Cursor mCursor =
                db.query(true, DATABASE_TABLE, new String[] {
                		KEY_ROWID,
                		KEY_ISBN, 
                		KEY_TITLE,
                		KEY_PUBLISHER
                		}, 
                		KEY_ROWID + &quot;=&quot; + rowId, 
                		null,
                		null, 
                		null, 
                		null, 
                		null);
        if (mCursor != null) {
            mCursor.moveToFirst();
        }
        return mCursor;
    }

    //---updates a title---
    public boolean updateTitle(long rowId, String isbn, 
    String title, String publisher) 
    {
        ContentValues args = new ContentValues();
        args.put(KEY_ISBN, isbn);
        args.put(KEY_TITLE, title);
        args.put(KEY_PUBLISHER, publisher);
        return db.update(DATABASE_TABLE, args, 
                         KEY_ROWID + &quot;=&quot; + rowId, null) &gt; 0;
    }
}</description>
		<content:encoded><![CDATA[<p>I have an issue regarding creating db on sd card. the following code just creats a db file on sd card but no tables inside that file. please help me<br />
public class DBAdapter<br />
{<br />
    public static final String KEY_ROWID = &#8220;_id&#8221;;<br />
    public static final String KEY_ISBN = &#8220;isbn&#8221;;<br />
    public static final String KEY_TITLE = &#8220;title&#8221;;<br />
    public static final String KEY_PUBLISHER = &#8220;publisher&#8221;;<br />
    private static final String TAG = &#8220;DBAdapter&#8221;;</p>
<p>    private static final String DATABASE_NAME = &#8220;books&#8221;;<br />
    private static final String DATABASE_TABLE = &#8220;titles&#8221;;<br />
    private static final int DATABASE_VERSION = 1;</p>
<p>    private static final String DATABASE_CREATE =<br />
        &#8220;create table titles (_id integer primary key autoincrement, &#8221;<br />
        + &#8220;isbn text not null, title text not null, &#8221;<br />
        + &#8220;publisher text not null);&#8221;;</p>
<p>    private final Context context;<br />
//    public File dbfile = new File(&#8220;/sdcard/mydb.db&#8221; ); </p>
<p>    private DatabaseHelper DBHelper;<br />
    private SQLiteDatabase db;</p>
<p>    public DBAdapter(Context ctx)<br />
    {<br />
        this.context = ctx;<br />
        DBHelper = new DatabaseHelper(context);</p>
<p>        SQLiteDatabase.openOrCreateDatabase(&#8220;/sdcard/rapidandroid/mydb2.db&#8221;, null);<br />
    }</p>
<p>    private static class DatabaseHelper extends SQLiteOpenHelper<br />
    {<br />
        DatabaseHelper(Context context)<br />
        {<br />
            super(context, DATABASE_NAME, null, DATABASE_VERSION);<br />
        }</p>
<p>        @Override<br />
        public void onCreate(SQLiteDatabase db)<br />
        {<br />
            db.execSQL(DATABASE_CREATE);<br />
        }</p>
<p>        @Override<br />
        public void onUpgrade(SQLiteDatabase db, int oldVersion,<br />
        int newVersion)<br />
        {<br />
            Log.w(TAG, &#8220;Upgrading database from version &#8221; + oldVersion<br />
                    + &#8221; to &#8221;<br />
                    + newVersion + &#8220;, which will destroy all old data&#8221;);<br />
            db.execSQL(&#8220;DROP TABLE IF EXISTS titles&#8221;);<br />
            onCreate(db);<br />
        }<br />
    } </p>
<p>    //&#8212;opens the database&#8212;<br />
    public DBAdapter open() throws SQLException<br />
    {</p>
<p>    	db=SQLiteDatabase.openOrCreateDatabase(&#8220;/sdcard/rapidandroid/mydb2.db&#8221;, null);</p>
<p>        return this;<br />
    }</p>
<p>    //&#8212;closes the database&#8212;<br />
    public void close()<br />
    {<br />
        DBHelper.close();<br />
    }</p>
<p>    //&#8212;insert a title into the database&#8212;<br />
    public long insertTitle(String isbn, String title, String publisher)<br />
    {<br />
        ContentValues initialValues = new ContentValues();<br />
        initialValues.put(KEY_ISBN, isbn);<br />
        initialValues.put(KEY_TITLE, title);<br />
        initialValues.put(KEY_PUBLISHER, publisher);<br />
        return db.insert(DATABASE_TABLE, null, initialValues);<br />
    }</p>
<p>    //&#8212;deletes a particular title&#8212;<br />
    public boolean deleteTitle(long rowId)<br />
    {<br />
        return db.delete(DATABASE_TABLE, KEY_ROWID +<br />
        		&#8220;=&#8221; + rowId, null) &gt; 0;<br />
    }</p>
<p>    //&#8212;retrieves all the titles&#8212;<br />
    public Cursor getAllTitles()<br />
    {<br />
        return db.query(DATABASE_TABLE, new String[] {<br />
        		KEY_ROWID,<br />
        		KEY_ISBN,<br />
        		KEY_TITLE,<br />
                KEY_PUBLISHER},<br />
                null,<br />
                null,<br />
                null,<br />
                null,<br />
                null);<br />
    }</p>
<p>    //&#8212;retrieves a particular title&#8212;<br />
    public Cursor getTitle(long rowId) throws SQLException<br />
    {<br />
        Cursor mCursor =<br />
                db.query(true, DATABASE_TABLE, new String[] {<br />
                		KEY_ROWID,<br />
                		KEY_ISBN,<br />
                		KEY_TITLE,<br />
                		KEY_PUBLISHER<br />
                		},<br />
                		KEY_ROWID + &#8220;=&#8221; + rowId,<br />
                		null,<br />
                		null,<br />
                		null,<br />
                		null,<br />
                		null);<br />
        if (mCursor != null) {<br />
            mCursor.moveToFirst();<br />
        }<br />
        return mCursor;<br />
    }</p>
<p>    //&#8212;updates a title&#8212;<br />
    public boolean updateTitle(long rowId, String isbn,<br />
    String title, String publisher)<br />
    {<br />
        ContentValues args = new ContentValues();<br />
        args.put(KEY_ISBN, isbn);<br />
        args.put(KEY_TITLE, title);<br />
        args.put(KEY_PUBLISHER, publisher);<br />
        return db.update(DATABASE_TABLE, args,<br />
                         KEY_ROWID + &#8220;=&#8221; + rowId, null) &gt; 0;<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: farhan</title>
		<link>http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-iv-android-content-providers/comment-page-1/#comment-528</link>
		<dc:creator>farhan</dc:creator>
		<pubDate>Tue, 02 Nov 2010 10:49:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=81#comment-528</guid>
		<description>You have given here good tutorial but i want to know that how to add Emails and other Contact Information in 2.2 as it is difficult to find each respective columns and Uri&#039;s. Please tell me i will be very thankful to you.</description>
		<content:encoded><![CDATA[<p>You have given here good tutorial but i want to know that how to add Emails and other Contact Information in 2.2 as it is difficult to find each respective columns and Uri&#8217;s. Please tell me i will be very thankful to you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

