How can I reach contacts when I have taken permission? - android

I am writing an application to Google Play. I have to take permission from user because İf I don"t my app will be shut down. My purpose is first time user start my app. I want to take Contacts permission from him/her then load her/his contacts to customized listview. But When I want permission from users, My contacts are not loading to my customized Listview. How can I fix it?
Here my permission is in xml file
<uses-permission android:name="android.permission.READ_CONTACTS"
/>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
My request Permissions method:
if (ContextCompat
.checkSelfPermission(MainActivity.this,
Manifest.permission.READ_CONTACTS) != (int) PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.CALL_PHONE)
!= (int)PackageManager.PERMISSION_GRANTED) {
// Check if user has opted "Never show again"
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.READ_CONTACTS) ||
ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.CALL_PHONE)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[] {
Manifest.permission.READ_CONTACTS,
Manifest.permission.CALL_PHONE
}, requestCode);
}
}
} else {
getNumber(this.getContentResolver()); // it is taking method of contacts
}
chosinglist = (ListView) findViewById(R.id.chosing);
chosinglist.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
GetNumber methods:
private void getNumber(ContentResolver contentResolver) {
Cursor cursor = contentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if (cursor.moveToFirst()) {
// ArrayList<String> alContacts = new ArrayList<String>();
do {
String id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
if (Integer.parseInt(cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
Cursor pCur = contentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[]{id}, null);
while (pCur.moveToNext()) {
String phoneNumber = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
String name = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
listte.add(name);
listtearama.add(phoneNumber);
// alContacts.add(contactNumber);
break;
}
pCur.close();
}
} while (cursor.moveToNext());
}
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.checkrow,
R.id.checkedTextView2, listte);
kaydet.setEnabled(false);
chosinglist.setAdapter(adapter); }

I think you are initializing ListView after fetching the contacts
Try this:
chosinglist = (ListView) findViewById(R.id.chosing);
chosinglist.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
if (permissionNotGranted)
{
}
else
{
getNumber(this.getContentResolver()); // it is taking method of contacts
}

Please try this:
if (ContextCompat
.checkSelfPermission(MainActivity.this,
Manifest.permission.READ_CONTACTS) != (int) PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.CALL_PHONE)
!= (int)PackageManager.PERMISSION_GRANTED) {
// Check if user has opted "Never show again"
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.READ_CONTACTS) ||
ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.CALL_PHONE)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[] {
Manifest.permission.READ_CONTACTS,
Manifest.permission.CALL_PHONE
}, requestCode);
}else{
getContactDetails();
}
}
} else {
getContactDetails(); // it is taking method of contacts
}
public void getContactDetails() {
ContentResolver cr = getActivity().getContentResolver();
String[] PROJECTION = new String[]{ContactsContract.RawContacts._ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.Contacts.PHOTO_ID,
ContactsContract.CommonDataKinds.Email.DATA,
ContactsContract.CommonDataKinds.Phone.NUMBER,
ContactsContract.RawContacts.VERSION};
String order = "CASE WHEN "
+ ContactsContract.Contacts.DISPLAY_NAME
+ " NOT LIKE '%#%' THEN 1 ELSE 2 END, "
+ ContactsContract.Contacts.DISPLAY_NAME
+ ", "
+ ContactsContract.CommonDataKinds.Phone.DATA
+ " COLLATE NOCASE";
String filter = ""+ ContactsContract.Contacts.HAS_PHONE_NUMBER + " > 0 and " + ContactsContract.CommonDataKinds.Phone.TYPE +"=" + ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE;
Cursor cur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION, filter, null, order);
for (int i = 0; i < cur.getColumnCount(); i++) {
Timber.e("column " + i + "=" + cur.getColumnName(i));
}
if (cur.moveToFirst()) {
do {
String name = cur.getString(1);
String number = cur.getString(4);
number = Utils.removeExtraCharFromString(number);
if (number.length() > 8) {
mContactNumbers = mContactNumbers + number + ",";
PhoneContacts phoneContacts = new PhoneContacts();
try {
phoneContacts.setName(URLEncoder.encode(name, "UTF-8"));
phoneContacts.setNumber(number);
phoneContacts.setNameInitial(String.valueOf(phoneContacts.getName().charAt(0)));
listOfContactsRaw.add(phoneContacts);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
} while (cur.moveToNext());
}
cur.close();
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
Set set = new TreeSet(new Comparator() {
#Override
public int compare(Object o1, Object o2) {
PhoneContacts phoneContacts1 = (PhoneContacts) o1;
PhoneContacts phoneContacts2 = (PhoneContacts) o2;
if (phoneContacts1.getNumber().equalsIgnoreCase(phoneContacts2.getNumber())) {
return 0;
}
return 1;
}
});
set.addAll(listOfContactsRaw);
System.out.println("\n***** After removing duplicates *******\n");
listOfContacts = new ArrayList(set);
initRecyclerView();
}
}, 200);
}

Related

CalendarProvider, how to get meeting's owner name?

I need to get the meeting's owner name from the CalendarProvider.
I've found these two rows:
CalendarContract.Events.ORGANIZER,
CalendarContract.Events.OWNER_ACCOUNT
But they return only creator's email.
How can I fetch the creator's name?
Try below code for getting Events details.
For more details you can check google android calendar docs
https://developer.android.com/guide/topics/providers/calendar-provider
// add below permission in your app manifest file and also ask these two permission at run time
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
// add below method in your activity
public void getOrganizerName() {
Cursor cur = null;
ContentResolver cr =getContentResolver();
Uri uri=CalendarContract.Events.CONTENT_URI;
String[] eventmProjection =
{CalendarContract.Calendars._ID,
CalendarContract.Events.DTSTART,
CalendarContract.Events.DTEND,
CalendarContract.Events.TITLE,
CalendarContract.Events.EVENT_LOCATION,
CalendarContract.Events.ORGANIZER,
CalendarContract.Events._ID,
CalendarContract.Events.DESCRIPTION,
CalendarContract.Events.DURATION,
CalendarContract.Events.SYNC_DATA1,
CalendarContract.Events.DIRTY,
CalendarContract.Events.UID_2445,
CalendarContract.Events.DELETED,
CalendarContract.Events.LAST_DATE,
CalendarContract.Events.SYNC_DATA2,
CalendarContract.Events.ALL_DAY,
CalendarContract.Events.RRULE,
CalendarContract.Events.STATUS,
CalendarContract.Events.RDATE
};
String selection = "(" + CalendarContract.Calendars.ACCOUNT_NAME + " = ? AND deleted != 1 AND " + CalendarContract.Events.ORGANIZER + " != ?)";
// pass here google calendar sync account detials
String[] selectionArgs = new String[]{"abc#gmail.com","abc#gmail.com"};
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CALENDAR},12);
}
cur = cr.query(uri, eventmProjection, selection, selectionArgs, null);
if(cur.getCount()>0){
while (cur.moveToNext()) {
String eventTitle = cur.getString(cur.getColumnIndex(CalendarContract.Events.TITLE));
String eventId = cur.getString(cur.getColumnIndex(CalendarContract.Events._ID));
String startDate = cur.getString(cur.getColumnIndex(CalendarContract.Events.DTSTART));
String endDate = cur.getString(cur.getColumnIndex(CalendarContract.Events.DTEND));
String org_name=cur.getString(cur.getColumnIndex(CalendarContract.Events.ORGANIZER));
Log.d("Events", "->" + eventTitle + "->" + eventId + "->" + startDate + "->" + endDate+ "->"+org_name);
}
}
}
After you quired all needed events, when you are in Cursor loop, for every event you can get a name by this method:
private String getOrganizerNameFromAttendees(int eventId, String organizerMail) {
Logger.e(TAG, "getOrganizerNameFromAttendees");
final String[] args = new String[]{String.valueOf(eventId), organizerMail};
final Cursor cursor = mApplicationContext.getContentResolver().query(CalendarContract.Attendees.CONTENT_URI, ATTENDEE_PROJECTION, ATTENDEE_SELECTION, args, null);
String name = null;
try {
while (cursor.moveToNext()) {
String nameFromAttendees = cursor.getString(ATTENDEE_PROJECTION_NAME_INDEX);
String mailFromAttendees = cursor.getString(ATTENDEE_PROJECTION_MAIL_INDEX);
name = TextUtils.isEmpty(nameFromAttendees) ? mailFromAttendees : nameFromAttendees;
}
} catch (Exception e) {
Logger.e(TAG, "getOrganizerNameFromAttendees, exception = " + e.getMessage());
} finally {
if (cursor != null) {
cursor.close();
}
}
return name;
}

Android run time permission error

I am developing an application that required to access contacts in phone. this method is executed inside a thread. But when app start for the first time it crashes and says android.permission.READ_CONTACTS or android.permission.READ_CONTACTS required as error. as soon as press on OK in on error pop up dialog box. it restart it self asking for permission and works fine.
here's the code inside fragment on onCreateView method to check whether permission already has been granted.
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_CONTACTS)
== PackageManager.PERMISSION_GRANTED) {
Runnable r = new Runnable() {
#Override
public void run() {
getContacts();
}
};
Thread thread = new Thread(r);
thread.start();
}else{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (shouldShowRequestPermissionRationale(Manifest.permission.READ_CONTACTS)) {
Toast.makeText(getActivity(),"Read contacts permission is required to function app correctly",Toast.LENGTH_LONG)
.show();
}
requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, REQUEST_READ_CONTACTS);
}
}
here's the onRequestPermissionsResult method.
#Override
public void onRequestPermissionsResult(int requestCode, #NonNull String[] permissions, #NonNull int[] grantResults) {
switch (requestCode){
case REQUEST_READ_CONTACTS :
Runnable r = new Runnable() {
#Override
public void run() {
getContacts();
}
};
Thread thread = new Thread(r);
thread.start();
break;
default:
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
here's the code for get contact method.
public void getContacts() {
ContentResolver cr = getActivity().getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if (cur != null) {
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
String imgPath = cur.getString(cur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI));
if (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
Cursor ncur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[]{id}, null);
if (ncur != null) {
while (ncur.moveToNext()) {
String phoneNumber = ncur.getString(ncur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
String reDefinedPhoneNumber = "";
if (phoneNumber.contains("-")) {
String[] split = phoneNumber.split("-");
for (String k : split) {
reDefinedPhoneNumber = reDefinedPhoneNumber.concat(k);
}
} else if (phoneNumber.contains(" ")) {
String[] split = phoneNumber.split(" ");
for (String k : split) {
reDefinedPhoneNumber = reDefinedPhoneNumber.concat(k);
}
} else {
reDefinedPhoneNumber = phoneNumber;
}
Contact contact = new Contact();
contact.setId(contact.getId());
contact.setName(name);
contact.setNumber(reDefinedPhoneNumber);
contact.setImgPath(imgPath);
contacts.add(contact);
}
ncur.close();
}
}
}
}
cur.close();
}
}
Here's AndroidManifest.xml code.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shan.chathuranga.smsscheduler">
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
</manifest>
what am I doing wrong. works fine in below marshmallow.

How to delete contacts from sim in android

I did following code for deleting selected contacts from sim card. but its not deleting and also not throwing any error.
protected void DeleteContacts(ArrayList<String> ids){
int flg = 0;
String[] strids = new String[ids.size()];
strids = ids.toArray(strids);
for (int i = 0; i < strids.length; i++) {
Cursor sims = getActivity().getContentResolver().query(
Uri.parse("content://icc/adn"), null,
"_id=?", new String[]{strids[i]}, null);
sims.moveToFirst();
if (sims.getCount()>0) {
String phoneNumber = sims.getString(sims.getColumnIndex("number"));
boolean val = deleteContact(phoneNumber);
if (!val)
flg=1;
}
if (flg == 0)
Toast.makeText(getActivity(), "Contact Deleted", Toast.LENGTH_SHORT).show();
sims.close();
}
}
public boolean deleteContact(String phone) {
Cursor cur = getActivity().getContentResolver().query(Uri.parse("content://icc/adn"), null, "number=?", new String[] { phone }, null);
try {
if (cur.moveToFirst()) {
do {
String lookupKey = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey);
getActivity().getContentResolver().delete(uri, null, null);
return true;
} while (cur.moveToNext());
}
} catch (Exception e) {
System.out.println(e.getStackTrace());
}
return false;
}
You are deleting the contacts from the sqlite database and not the SIM card. For deleting contacts from the SIM card, you need to delete on Uri.parse("content://icc/adn") uri only. But for deletion you need to provide both name and number. Name column has to specified as tag. Check for delete method here https://android.googlesource.com/platform/frameworks/opt/telephony/+/9ebea45a36838f0547a9c30f7cd9c60b03aab3b4/src/java/com/android/internal/telephony/IccProvider.java
Based on my answer here, here is the solution :
Uri simUri = Uri.parse("content://icc/adn/");
ContentResolver mContentResolver = this.getContentResolver();
Cursor c = mContentResolver.query(simUri, null, null, null, null);
if (c.moveToFirst())
{
do
{
if (/* your condition here */)
{
mContentResolver.delete(
simUri,
"tag='" + c.getString(c.getColumnIndex("name")) +
"' AND " +
"number='" + c.getString(c.getColumnIndex("number")) + "'"
, null);
break;
}
}
while (c.moveToNext());
}
Off course, don't forget these permissions :
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />

Retrieving Phone Number from Android Contacts Doesn't Work On Samsung

When I put the code in starting from the line "// Using the contact ID now we will get contact phone number" to the line "cursorPhone.close", it doesn't display any contact info on my s3 or note 3, but does display it on my asus tablet. If i take out the code between the lines mentioned above, the code works on s3 and note 3. What am i doing wrong? There are no errors in the log.
private void getContacts() {
try {
String[] projection = new String[] {
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.Contacts.HAS_PHONE_NUMBER,
ContactsContract.Contacts._ID };
mCursor = managedQuery(ContactsContract.Contacts.CONTENT_URI,
projection, ContactsContract.Contacts.HAS_PHONE_NUMBER + "=?", new String[] { "1" },
ContactsContract.Contacts.DISPLAY_NAME);
String phoneNumber = '';
while (mCursor.moveToNext()) {
contact contact = new contact();
String contactId = mCursor.getString(mCursor.getColumnIndex(ContactsContract.Contacts._ID));
contact.setContactName(mCursor.getString(mCursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)));
// Using the contact ID now we will get contact phone number
Cursor cursorPhone = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER},
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ? AND " +
ContactsContract.CommonDataKinds.Phone.TYPE + " = " +
ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE,
new String[]{contactId},
null);
if (cursorPhone.moveToFirst()) {
phoneNumber = (cursorPhone.getString(cursorPhone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)));
}
cursorPhone.close();//till here
contact_list.add(contact);
}
isChecked = new boolean[mCursor.getCount()];
for (int i = 0; i < isChecked.length; i++) {
isChecked[i] = false;
}
this.mContactAdapter = new contactAdapter(this, R.layout.contactlistview, contact_list);
lv.setAdapter(this.mContactAdapter);
mCursor.close();
runOnUiThread(returnRes);
} catch (Exception e) {
Log.d("getContacts", e.getMessage());
}
}
why dont you try to open inbuild Contact activity using -
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT); Hope this helps you.
You need to handle code In Activity Result Method of Activty like this:
if (reqCode == PICK_CONTACT && resultCode == Activity.RESULT_OK) {
// final String phoneNumber = data.getStringExtra("android.intent.extra.PHONE_NUMBER");
if (data != null) {
Uri uri = data.getData();
if (uri != null) {
Cursor c = null;
try {
c = getContentResolver().query(uri, new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER},
null, null, null);
if (c != null && c.moveToFirst()) {
String number = c.getString(0);
number=number.replaceAll("\\s", "");
number=number.replaceAll("-", "");
edtPhoneNumber.setText(number);
}
} finally {
if (c != null) {
c.close();
}
}
}
}
finishActivity(PICK_CONTACT);
}
if (reqCode == PICK_CALLLOG && resultCode == Activity.RESULT_OK) {
edtPhoneNumber.setText(data.getStringExtra("CallerNumber"));
}
if (reqCode == PICK_SMSLOG && resultCode == Activity.RESULT_OK) {
edtPhoneNumber.setText(data.getStringExtra("CallerNumber"));
}
}

How to Get Contact name, number and emai ID from a list of contacts?

I am new to android ,I need to get the details of my contacts, but the details include only 3
Contact name
contact number and
Email ID
when I press a Button it will show these 3 details of my all contacts
I am using android Eclair version 2.1. Any solution ?
By below code you can do that -
public void doLaunchContactPicker(View view) {
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (resultCode == RESULT_OK) {
switch (requestCode)
{
case CONTACT_PICKER_RESULT:
Cursor cursor = null;
String email = "", name = "";
try {
Uri result = data.getData();
Log.v(DEBUG_TAG, "Got a contact result: " + result.toString());
// get the contact id from the Uri
String id = result.getLastPathSegment();
// query for everything email
cursor = getContentResolver().query(Email.CONTENT_URI, null, Email.CONTACT_ID + "=?", new String[] { id }, null);
int nameId = cursor.getColumnIndex(Contacts.DISPLAY_NAME);
int emailIdx = cursor.getColumnIndex(Email.DATA);
// let's just get the first email
if (cursor.moveToFirst()) {
email = cursor.getString(emailIdx);
name = cursor.getString(nameId);
Log.v(DEBUG_TAG, "Got email: " + email);
} else {
Log.w(DEBUG_TAG, "No results");
}
} catch (Exception e) {
Log.e(DEBUG_TAG, "Failed to get email data", e);
} finally {
if (cursor != null) {
cursor.close();
}
EditText emailEntry = (EditText) findViewById(R.id.editTextv);
EditText personEntry = (EditText) findViewById(R.id.person);
emailEntry.setText(email);
personEntry.setText(name);
if (email.length() == 0 && name.length() == 0)
{
Toast.makeText(this, "No Email for Selected Contact",Toast.LENGTH_LONG).show();
}
}
break;
}
} else {
Log.w(DEBUG_TAG, "Warning: activity result not ok");
}
}
And, also refer these links -
Get Contact Details
How to Read Contacts
Get All Contact Details
Don't forget to add the required permission -
<uses-permission android:name="android.permission.READ_CONTACTS"/>
in your AndroidManifest.xml file. And, Just modify this code with your needs.
You can access addressbook like this;
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,null, null,ContactsContract.Contacts.DISPLAY_NAME);
int kisiSayisi = cur.getCount();
if(kisiSayisi > 0)
{
int KisiIndex = 0;
while(cur.moveToNext())
{
String id = cur.getString(cur.getColumnIndex(BaseColumns._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
if (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0)
{
Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID+ " = ?", new String[] { id }, null);
while (pCur.moveToNext())
{
String phone = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DATA));
//String phoneType = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE));
String dogruGSM = gsmNoKontrol(phone);
if(dogruGSM.compareTo("0") != 0){
Kisi kisi = new Kisi(KisiIndex, name, dogruGSM, false);
MyList.add(kisi);
KisiIndex ++;
}
}
pCur.close();
}
}
}

Categories

Resources