Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.testingapp;
- import android.database.Cursor;
- import android.provider.ContactsContract;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.BaseAdapter;
- import java.util.ArrayList;
- /**
- * Created by omarq on 09-Aug-16.
- */
- class contactsRow {
- String image;
- String name;
- String number;
- }
- class ContactsAdapter extends BaseAdapter {
- ArrayList<contactsRow> contactsArray;
- ContactsAdapter() {
- contactsArray = new ArrayList<contactsRow>();
- Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
- while (phones.moveToNext()) {
- String name = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
- String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
- //Toast.makeText(getActivity().getApplicationContext(),name, Toast.LENGTH_LONG).show();
- String full = name + " " + phoneNumber;
- }
- }
- @Override
- public int getCount() {
- return 0;
- }
- @Override
- public Object getItem(int i) {
- return null;
- }
- @Override
- public long getItemId(int i) {
- return 0;
- }
- @Override
- public View getView(int i, View view, ViewGroup viewGroup) {
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement