代码:package dev.sky.android.content_provider;import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.ContactsContract.Contacts;public class ContentProviderActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Cursor cursor = getContentResolver().query(Contacts.CONTENT_URI, null, null, null, null);
}
}我只是加了Cursor cursor = getContentResolver().query(Contacts.CONTENT_URI, null, null, null, null);这句。为什么会出错?不明白!而且联系人我已经添加了!
import android.database.Cursor;
import android.os.Bundle;
import android.provider.ContactsContract.Contacts;public class ContentProviderActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Cursor cursor = getContentResolver().query(Contacts.CONTENT_URI, null, null, null, null);
}
}我只是加了Cursor cursor = getContentResolver().query(Contacts.CONTENT_URI, null, null, null, null);这句。为什么会出错?不明白!而且联系人我已经添加了!
解决方案 »
- C#的加密算法,求翻译
- 求助!android短信发送后写入短信库
- 一个按钮上的文字不居中显示的问题
- 如何在电脑中运行《Android应用开发详解》中的移动警务通?
- webview中,载入后的页面中,需判断再进入下一页面,在线等
- android上的webview缩放问题!急求解答!!
- 修改spinner点击后样式的疑问--android,谢谢指导~~
- 下载的下来程序出现错误数据
- #(Unable to start activity ComponentInfo{XXX}: java.lang.NullPointerException)#
- app在真机上运行很卡
- Appwidget怎么和服务会话?
- viewgroup使用的问题
Uri.parse("content://com.ydq.db.MyContentProvider/"+SqliteHelper.TB_NAME);
把com.ydq.db.MyContentProvider 换成你自己的ContentProvider类所在的包名+类名
http://developer.android.com/guide/topics/providers/content-providers.html
<uses-permission android.permission.READ_CONTACT />