lundi 29 février 2016

cant delete the value from inbox at specific number

i didnt write this code , this code has been given to me for some changes but some of the features are not working like a deleting conversation method. here is the Deleting method

        public static boolean deleteSmsofContact(Context context, String number,
        boolean deleteLocked)
{
    int result;

    if (deleteLocked) {

       //URI_SMS = Uri.parse("content://sms/");


        result = context.getContentResolver().delete(Constants.URI_SMS,
                "address = ?",new String[]{ number });

    } else {
        result = context.getContentResolver().delete(Constants.URI_SMS,
                "address = ? AND locked = ?", new String[] { number, "1" });
    }

    if (result > 0) {
        return true;
    }

    return false;
}

from where i am calling this method

 boolean result = Utils.deleteSmsofContact(InboxActivity.this,    sms.getNumber(), true);
                                            if (result) {
                                                  dataList.remove(threadPosition);
                                                iAdapter.notifyDataSetChanged();
                                                Toast.makeText(InboxActivity.this,"Removed",Toast.LENGTH_LONG).show();
                                            }else
                                            {
                                                Toast.makeText(InboxActivity.this,"cant removed",Toast.LENGTH_LONG).show();
                                            }

Aucun commentaire:

Enregistrer un commentaire