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. Location Change Triggering for Network but not for GPS

When setting up a listener for location changes, is there anything
different that is required to trigger the GPS to get a location fix that
you don't need to do for network?

I am using the followig code:

mLocationManager.requestLocationUpdates( provider,
                                         LOCATION_PERIOD,
                                         LOCATION_CHANGE_TRIGGER,
                                         this );

In the code that follows, if provider is equal to "network", the
onLocationChanged method is called almost immediately.  If the provider
is "gps", it does not seem to get triggered ever (and I waited a while).
Is there something else that needs to be done in order to force the GPS
to actually get a fix?


-- 
Jake Colman -- Android Tinkerer

-- 

2. Anything wrong with this view?

Hi

I have a view layout as bellow. It has an EditText input box and a
scroll text (TextView) window. After the testShell activity is
started, it will bind to a service. The service is simply accept the
EditText input and send back to the TextView. If I start the testShell
then exit, the testShell will bind to the Service and then unbind to
the Service. The view works OK. But if I start the Service manually
from another activity, then start the testShell, the testShell will do
the samething, bind to the service. However, when I exit the testShell
and comeback again, it seems the previous EditText and TextView are
still exist and are not freed. When I type in the command from the
current EditText window, it sends the text to the previous TextView
which are not visiable to the current window. Can someone help me why
the previous views (TextView and EditText) are not freed when bind to
the existing Service?

thanks,

// scrollbar.xml
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:gravity="bottom">

        <ScrollView
        android:id="@+id/scrollview"
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="1">

        <TextView
        android:id="@+id/shellview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    </ScrollView>

        <EditText android:id="@+id/cmdText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>
</LinearLayout>

public class testShell extends Activity implements OnClickListener,
OnKeyListener{
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);

                setContentView(R.layout.scrollbar);
                sv=(ScrollView) findViewById(R.id.scrollview);
                mTextview = (TextView) findViewById(R.id.shellview);
                mCmdview = (EditText) findViewById (R.id.cmdText);


                initView();

                //TextView textview = new TextView(this);
                mTextview.setText("This is the testShell Tab\r\n");
                doBindService();
        }

        @Override
        protected void onDestroy() {
                super.onDestroy();
                doUnbindService();

        }

              // some handling codes here

}

-- 

3. bionic getprotoname issue?

4. Animation with only one view

5. Several Overlays on Mapview

6. Is singleTask honored by "The Monkey"?

7. Display Independent Pixel issues