1

こんにちは、Android の連絡先リスト (名前と番号) で 2 つの詳細を取得する詳細な説明または例をお願いします。これらの詳細を受け取ったら、XMLファイルに書き込みたいと思います。この XML ファイルを php サーバーに送信する必要があるためです。

これを行うために必要な許可が

<uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission>

私はAndroidCursorで作業しContactsContract、これを行う必要があります。しかし、同じことをする良い例を見つけることができません。誰かが探しているものの良いポインタまたは詳細な例を提供できれば、非常に高く評価されます。前もって感謝します。

4

2 に答える 2

0
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello" />

<ListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>
于 2013-05-30T08:06:14.360 に答える
0
private void readContacts() {
    String[] projection = {ContactsContract.Contacts.DISPLAY_NAME};
    Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, projection, null, null, null);
    Log.i("Demo", "" + cursor.getCount());
    String[] strs = new String[cursor.getCount()];
    cursor.moveToFirst();
    int i = 0;
    do {
        strs[0] = cursor.getString(0);
    }while (cursor.moveToNext());

    ArrayAdapter<String> liststr = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
    getListView().setAdapter(liststr);
}

}

于 2013-05-30T08:00:38.257 に答える