How delete a particular call log from call log list

by Gulfam » Thu, 12 Mar 2009 15:33:36 GMT


Sponsored Links
 Hi,

   I have deleted whole call log by the following statement
context.getContentResolver().delete
(CallLog.Calls.CONTENT_URI,null,null);

but i am facing problem to delete particular call log from call log
list by the following code any one can help me.
 if any one have successfully delete particular call log please change
in my following code i want to delete that numbers form call log that
starts with + or 00 its urgent.

Uri   delUri = Uri.withAppendedPath(CallLog.Calls.CONTENT_URI,"");
Cursor cursor =      context.getContentResolver().query
(delUri,null,null,null,null);

                                                                
context.getContentResolver().delete
(delUri,"_id="+cursor.getCount(),null);

Thanks & Regards,
Gulfam
--~--~---------~--~----~------------~-------~--~----~



How delete a particular call log from call log list

by Eric » Fri, 13 Mar 2009 01:43:04 GMT


 You need to iterate through your Cursor and get the _id values of the
entries you want to delete (the ones who number starts with + or 00).
Then you can delete that individual entries.

// assume the row you want to delete has an _id value of 2
getContentResolver().delete(delUri, "_id=2", null)


What you were doing was incorrect because  you were setting the _id to
cursor.getCount() which doesn't make sense.

  Eric





--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Storing data on the SD card in Froyo - files deleted when upgrading

So this bug appears to still exist on the 2.2 devices that we work
with on the market (Motorola Droid with the latest 2.2 OTA) and even
on the Google API 2.2 SDK emulator. I think that it is wildly
unreasonable that this bug is not reflected in the main documentation
at

http://developer.android.com/guide/topics/data/data-storage.html

or developer docs at

http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir%28java.lang.String%29

Would it be possible for the documentation to be updated to reflect
the fact that you should only "write your data in the following
directory: /Android/data/<package_name>/files/ " if you are building
for an android environment which has the bug fixed (not sure if any
such environments currently exist...)

We started using the appropriate directory path (.../Android/data/
packagename/) before 2.2 was rolled out in anticipation of taking
advantage of it, meaning that we can no longer upgrade our application
(from the 2.1 installed version) without completely wrecking the
install, and I feel that it is unfortunate that despite the bug being
identified in July the documentation was not updated to reflect this
problem.

-Clayton Sims











> > > > > 

2. Persisting preference data from onDialogClose in DialogPreference doesn't work

In the API reference for the method onDialogClosed of DialogPreference
it says "Called when the dialog is dismissed and should be used to
save data to the SharedPreferences."

My problem is that nothing gets persisted when I call persistString
from onDialogClose. I can listen to changes to my component and
persist data then, but of course the right way is to do it in
onDialogClose. But for some reason this doesn't work.

I'm using the emulator, API level for 2.1 update 2 in Ubuntu.

Any ideas?

-- 

3. images in android

4. Streaming audio from windows c++ music studio application to android java application

5. Commands available for View Server class

6. Android 2.2 and SIM Toolkit

7. Crash report for ActivityThread.createThumbnailBitmap