我不想在非活动类中从CallLog.Calls.CONTENT_URI
获取数据。我使用游标从CallLog获取这些数据。但是在非活动类游标中显示了一些错误,所以我怎么能这样做呢?
目前正在这样做,
public class CallReceiver extends Activity {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
Cursor cursor = managedQuery(android.provider.CallLog.Calls.CONTENT_URI,null,null,null,null);
startManagingCursor(cursor);
答案 0 :(得分:10)
Cursor c = context.getContentResolver().query(uri, projection, selection, null, sortOrder);
if (c.moveToFirst()) {
...
}
c.close();