I see calllog and callitem in phone library.But is possible delete the calllog?
Thank you.
Thank you.
try {
String strNumberOne[] = {number};
Cursor cursor = getContentResolver().query(CallLog.Calls.CONTENT_URI, null, CallLog.Calls.NUMBER + "=? ", strNumberOne, "");
boolean bol = cursor.moveToFirst();
if (bol) {
do {
int idOfRowToDelete = cursor.getInt(cursor.getColumnIndex(CallLog.Calls._ID));
getContentResolver().delete(Uri.withAppendedPath(CallLog.Calls.CONTENT_URI, String.valueOf(idOfRowToDelete)), "", null);
} while (cursor.moveToNext());
}
} catch (Exception ex) {
System.out.print("Exception here ");
}
You can make a small library from this code.
try {
Toast.makeText(getApplicationContext(), "eseguito", Toast.LENGTH_SHORT).show();
String strNumberOne[] = { "+44numbertodelete" };
Cursor cursor = getContentResolver().query(CallLog.Calls.CONTENT_URI, null, CallLog.Calls.NUMBER + " = ? ", strNumberOne, "");
boolean bol = cursor.moveToFirst();
if (bol) {
do {
int idOfRowToDelete = cursor.getInt(cursor.getColumnIndex(CallLog.Calls._ID));
this.getContentResolver().delete(CallLog.Calls.CONTENT_URI,String.valueOf(idOfRowToDelete),null); // this line works and deletes the log
} while (cursor.moveToNext());
}
} catch (Exception ex) {
Toast.makeText(getApplicationContext(), "non eseguito", Toast.LENGTH_SHORT).show();
System.out.print("Exception here ");
}
}
}
public static boolean SaveSMS(BA ba, String filepath)
{
Cursor cursor1 = ba.context.getContentResolver().query(mSmsinboxQueryUri, new String[] { "_id", "thread_id", "address", "person", "date", "body", "type" }, null, null, null);
}
Thanks for your reply.
See this link: http://www.b4x.com/forum/libraries-...1-video-tutorial-creating-simple-library.html (about the missing step)
When I generate the javadoc, on the folder I have just 1 file: MyFirstLib.xml
I have not the jar file.
Every suggestion is appreciated.
regards
MyFirstLib done successfully
thanks for the help
hey, i am also looking for delete a callitem from calllog , can you please share your lib ?
thank you very much
Sub Process_Globals
Dim mfl As MyFirstLib
End Sub
Sub Button1_Click
mfl.deletecalllogs("+440000000000") ' where +44000000000 is a string with the number to be deleted from calllogs
End Sub
Dim reg As MyFirstLib
Dim sta,aa,sto,num As String
Dim aaa As CallLog
Dim ll As List
ll=aaa.GetAll(0)
For i =0 To ll.Size-1
aa=ll.Get(i)
sta=aa.IndexOf("Number=")+7
sto=aa.IndexOf(",CachedName=")
num=aa.SubString2(sta,sto)
If num<>"" Then
try
reg.DeleteCallLogs(num)
catch
end try
End If
Next
Log("fin")
You should read the 1st answer in this thread!!I use referer library for delete calllog but not deleted.
read only means that you can NOT delete anything (deleting is a WRITING action)No, it gives you read-only access