package com.cnyao.phot;
import android.app.Activity;
import android.content.ContentResolver;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.CallLog.Calls;
import android.widget.TextView;
public class CallLogQueryActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.call_log);
String tempStr="Columns: ";
ContentResolver resolver=this.getContentResolver();
Cursor cursor = resolver.query(Calls.CONTENT_URI,
null, null, null, Calls.DEFAULT_SORT_ORDER);
cursor.getCount();
cursor.moveToLast();
for(int i=0;i<cursor.getColumnCount();i++){
tempStr+=cursor.getColumnName(i)+",";
//tempStr+=cursor.getString(i)+",";
}
TextView tv1=(TextView)findViewById(R.id.callername);
tv1.setText(tempStr);
}
}
|