私は、Comp Eng Mobile App Classの紹介のために、この単一の関数に約1週間取り組んでおり、カーソル、コンテンツリゾルバー、およびアダプターについて理解し始めています。しかし、コードは、私がカーソルを使用しないことを認識していますが、このプログラムにカーソルを組み込む方法がわかりません。
public class HelloAutoCompleteActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ContentResolver content = getContentResolver();
Cursor cursor = content.query(Contacts.CONTENT_URI, PEOPLE_PROJECTION, null, null, ContactsContract.Contacts.DISPLAY_NAME + " ASC");
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_country);
// ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, PEOPLE_PROJECTION);
// textView.ContactListAdapter adapter = new textView.ContactListAdapter(this, cursor);
textView.setAdapter(adapter);
}
private static final String[] PEOPLE_PROJECTION = new String[] {
ContactsContract.Contacts._ID,
ContactsContract.CommonDataKinds.Phone.TYPE,
ContactsContract.CommonDataKinds.Phone.NUMBER,
ContactsContract.CommonDataKinds.Phone.LABEL,
ContactsContract.Contacts.DISPLAY_NAME
};
String[] projection = new String[] {
ContactsContract.Contacts._ID,
ContactsContract.Contacts._COUNT,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER
};
//Get the base URI for the People table in the Contacts content provider.
Uri contacts = ContactsContract.AUTHORITY_URI;
////Make the query.
Cursor cursor;
}