Hello Friends.
I'm writing a small backup application for contacts and i encountering
some weird problems.
Firs of all I retrive data through the content resolver:

contentResolver.query(contentUri, columns, null, null, null);

where content uri and columns are both taken from Contacts.People,
Contacts.People.Phones, Contacts.People.ContactMethods, etc. So I
extract several sets of data and save them. Later on I'm making
restore operation:
                for( HashMap<String, String> row : data )
                {
                        ContentValues values = new ContentValues();
                        for( String key : columns )
                        {
                                String value = row.get( key);
                                if( null != value && !"".equals( value))
                                {
                                        values.put( key, value);
                                }
                        }
                        String masterKey = row.get( BaseColumns._ID);
                        if( null != masterKey && !"".equals( masterKey) )
                        {
                                try
                                {
                                        contentResolver.delete(
                                                        Uri.withAppendedPath( 
contentUri, masterKey),
                                                        null, null);
                                }
                                catch(Throwable t)
                                {
                                        t.printStackTrace();
                                        //do nothing, to not to crash
                                }
                        }

                        try
                        {
                                contentResolver.insert( contentUri, values);
                        }
                        catch(Throwable t)
                        {
                                t.printStackTrace();
                        }
                }
Such operation done for each ContentProvider I retrieved data at
backup.
I'm not backuping Contacts.Photos, becouse I don't want to do that.
But next, strange thing happenning, when i try to attach photo to a
contact in Contacts application. First of I select a contact i wish to
modify. Then clicking to add icon. Selecting photo, cropping it. And
it appears near the contatc name in contact editing activity. But
after I click "Done" and android says that chages were successfully
changed, icon just dissappears like i never added it to a contact.
And nothing helps after this restore, I tried rebooting my phone,
deleting all contacts, deleting all contacts programaticatlly and all
this doesn't helps. The only thing that helps is factory data reset.
This problem both happens on emulator and on g1 phone. Later i had an
idea so i've taken  contacts.db file from fresh emulator, where photos
feature were still working and saved it. Then i performed backup-
restore operations. And compared the databases. They were identical.
And still photos weren't inserting anymore. And this probleblem also
happens wether I had any photos added to contacts before backup or all
contacts were without photos. So I'm kinda desperate now, becouse I
don't know what to do. And I hope someone here will help me =) So any
help would be appreciated.
Thanks in advance =)



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to