Incidentally, I am also writing a small backup tool and had a problem that sounds very similar to yours. I figured out, that adding photos does not work properly on the emulator.
I added a new menu option which, when clicked, added a photo from a binary stream to a hard-coded contact URI. When I pressed the button on the emulator, nothing happened. It was, as you said, as if nothing happened. I was close to rip out my hair on this. I tried everything. Just about an hour ago, in total resignation, I slumped back into my chair, pushed the app onto my phone and pressed the test-button... And it worked! Hurray! \o/ :) I hope that this is the same problem you are running into, and wish you the best of luck with the rest of the development :) On Aug 21, 3:46 pm, Alexander Kazanin <[email protected]> wrote: > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

