私はAndroid携帯のすべての通話履歴をプログラムでクリアしたいと思っています。そのための簡単なアプリを開発してみました。しかし、それは機能しておらず、誰かが私がそれをチェックするのを手伝ってくれることを願っています。
public class ClearLogActivity extends Activity implements OnClickListener{
/** Called when the activity is first created. */
Button clear;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
clear = (Button)findViewById(R.id.button1);
clear.setOnClickListener(this);
}
public void onClick(View view){
Cursor cursor = getContentResolver().query(CallLog.Calls.CONTENT_URI, null, null, null, null);
while(cursor.moveToNext()){
getContentResolver().delete(CallLog.Calls.CONTENT_URI, null, null);
}
}
}