Hello Friends!
Today I am going to share code for getting phone contact detail from your android phone.
It will pick all the phone number, email and profile picture also.
Just copy paste below code and enjoy..
Please comment for suggestion and help!
Thanks!
Today I am going to share code for getting phone contact detail from your android phone.
It will pick all the phone number, email and profile picture also.
Just copy paste below code and enjoy..
1)MainActivity.java
package com.example.phonecontactdetail; import java.io.FileNotFoundException; import java.io.IOException; import android.app.Activity; import android.content.ContentResolver; import android.database.Cursor; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.provider.MediaStore; import android.widget.TextView; public class MainActivity extends Activity { TextView textDetail; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textDetail = (TextView) findViewById(R.id.textView1); readContacts(); } public void readContacts() { StringBuffer sb = new StringBuffer(); sb.append("......Contact Details....."); ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); String phone = null; String emailContact = null; String emailType = null; String image_uri = ""; Bitmap bitmap = 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)); image_uri = cur .getString(cur .getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI)); if (Integer .parseInt(cur.getString(cur .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) { System.out.println("name : " + name + ", ID : " + id); sb.append("\n Contact Name:" + name); Cursor pCur = cr.query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[] { id }, null); while (pCur.moveToNext()) { phone = pCur .getString(pCur .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); sb.append("\n Phone number:" + phone); System.out.println("phone" + phone); } pCur.close(); Cursor emailCur = cr.query( ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?", new String[] { id }, null); while (emailCur.moveToNext()) { emailContact = emailCur .getString(emailCur .getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)); emailType = emailCur .getString(emailCur .getColumnIndex(ContactsContract.CommonDataKinds.Email.TYPE)); sb.append("\nEmail:" + emailContact + "Email type:" + emailType); System.out.println("Email " + emailContact + " Email Type : " + emailType); } emailCur.close(); } if (image_uri != null) { System.out.println(Uri.parse(image_uri)); try { bitmap = MediaStore.Images.Media .getBitmap(this.getContentResolver(), Uri.parse(image_uri)); sb.append("\n Image in Bitmap:" + bitmap); System.out.println(bitmap); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } sb.append("\n........................................"); } textDetail.setText(sb); } } }
2)activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_margin="10dp" android:text="TextView" /> </RelativeLayout>
Please comment for suggestion and help!
Thanks!
Thanks for this awesome project but let me ask, its failing to emulate...am using the target SDK as 15 and minimum SDK as 8...what could be the problem
ReplyDeleteHi Moris,It should work just put read contact permission in your manifest.xml-
DeleteAnd please test it on mobile phone only not on emulator... And if your device version is lower than 11 in that class please add below line for contact photo-
int SDK_INT = android.os.Build.VERSION.SDK_INT;
// System.out.println("******API Lavel*********"+SDK_INT);
if(SDK_INT>=11){
image_uri = cur.getString(cur
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI));
}
""
Deletei was only lacking the permission, thanks
ReplyDeleteYour welcome!
DeleteYour welcome!
Deleteawesome code.!.can u plz post the total project code for an contact app..i'm working on a project on this..bt i am stuck at listview..i am not able to display the contact names in the listview dynamically from the database..can u help?
ReplyDeleteCursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null);
ReplyDeleteArrayList> contactData = new ArrayList>();
while (cursor.moveToNext()) {
try{
int i1 = cursor.getColumnIndex(ContactsContract.Contacts._ID);
String contactId = cursor.getString(i1);
please explian me each line detailly
Hi Srujana! Please find the explanation below-
ReplyDelete//this is the cursor query for getting all contact detail from android phone database
Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null);
//contactData is a collection for storing record for future use
ArrayList> contactData = new ArrayList>();
//this line for check condition one by one record from cursor query
while (cursor.moveToNext()) {
try{
//here you will ger id of phone contact which is used as primary key
int i1 = cursor.getColumnIndex(ContactsContract.Contacts._ID);
//and i think above line is extra here no need to convert it into string again
//you can use below line-
String id = cur.getString(cur
.getColumnIndex(ContactsContract.Contacts._ID));
Thanks,
hello manish...its shows only text view ...?whats the problme..?
ReplyDeleteAre you testing on phone or on emulator? and do you have phone contacts there?
Deletehow to get all contact details? like organization,region,city,country ?
ReplyDeleteyes you can get all data from contact detail what android provide us. just use constructor of ContactsContract.Contacts like below, i am getting id. just replace _ID with your key. And please change type of int i1 to what you needed like String, Boolean etc.
Deleteint i1 = cursor.getColumnIndex(ContactsContract.Contacts._ID);
note: you can get only that data what android provide us.
Hi Manish,
ReplyDeleteThanks for the code. But the scrolling functionality is not working. And i am not getting all contacts. Can u please help me?
Just change your Relative Layout to ScrollView and if it not allow because scrollview only can have one direct child then add your Relative Layout inside Scroll-View and it will work fine.
DeleteCan u plz tell me, how to add a scroll view in the layout bcoz im new to android. Thanks in advance.
DeleteHi Manish
ReplyDeleteThanx for your reply. Now it's working fine. Can you help me with Source code to how to get GSM Signal Strength in Android?
Please try this code may be it will help you-
DeleteTelephonyManager telephonyManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
CellInfoGsm cellinfogsm = (CellInfoGsm)telephonyManager.getAllCellInfo().get(0);
CellSignalStrengthGsm cellSignalStrengthGsm = cellinfogsm.getCellSignalStrength();
cellSignalStrengthGsm.getDbm();
And don't forget to add permision in your manifext.xml file for telephony manager.
Hi Manish,
ReplyDeleteOne more thing i want to clarify. It is displaying the list of contacts in a xml file. But i need to enable the call functionality to that numbers. Is there any possibility? Please help me in this regard.
Just get phon number from list and set onItemClickListner on that Listview and inside that call a intent for make a call like-
DeletedataList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView parent, View v,
final int position, long id) {
// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "Your Phone_number"));
startActivity(intent);
}
});
And most Important add permision in your manifest-
Hi Manish,
ReplyDeleteThanks for the post. Can you help me to retrieve contact details of a particular number.
so just add a line in that query like-
Deleteif(phone.equals("921111111"){
sb.append("\n Phone number:" + phone);
}
It will append only that contact detail..
i want get mob no bt this code is not working..
Delete@Praroop- Telephony Manager does not guarantee to get the user mobile number, so kindly refer other method like take input from user and validated it using SMS.
DeleteHello ,can you please specify how to retrieve Photo uri of a contact in API< 11 ,
ReplyDeleteI think there is no way for below API level 11. Well if you got anything please let me know, I am looking for it.
DeleteThanks!
Hi Manish,
ReplyDeleteCan you help me by providing a source code to play a video file in Android through wifi. Awaiting for your response.
Thanks,
Mahesh K.
Hi Mahesh, your question is interesting and challenging too. So how do you want play video? you want play your android device video from outside using any device or something else?
DeleteHi Manish,
DeleteSorry for the delay. Actually i have an wifi URL. And i want to play it in my application. And actually the requirement is i want the source code for Youtube functionality like in Landscape mode when we press an icon then the video will get stretch and when we again press that icon then it will come to normal state and vice versa. I want the total source code for it. Can you provide me? Awaiting for your response.
Thanks,
Mahesh K.
Hi Manish,
DeleteI am waiting for your reply. Can you please provide the source code. So, that it will be more helpful to me. And i had another small doubt. I have put my application in Google Playstore. But sometimes i am getting crash reports. And one of the most common crash report is
java.lang.NullPointerException
at com.reliance.aptv.MainActivity.b(Unknown Source)
at com.reliance.aptv.bj.c(Unknown Source)
at com.reliance.aptv.by.a(Unknown Source)
at com.reliance.aptv.MainActivity.b(Unknown Source)
at com.reliance.aptv.bs.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3714)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
Can any help me why this crash report is coming.
Thanks in advance,
-Mahesh Babu K.
thanks for this example , and i have one query how to fetch the contact image and set into listview ,please help
ReplyDeletePlease check this line of code-
Deleteif (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));
int SDK_INT = android.os.Build.VERSION.SDK_INT;
// System.out.println("******API Lavel*********"+SDK_INT);
if(SDK_INT>=11){
image_uri = cur
.getString(cur
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI));
if (image_uri != null) {
// System.out.println(Uri.parse(image_uri));
try {
Bitmap bitmap = MediaStore.Images.Media
.getBitmap(this.getContentResolver(),
Uri.parse(image_uri));
// System.out.println(bitmap);
imageBase64String = Helper.encodeTobase64(bitmap);
objContact.put("profile_img", imageBase64String);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
hi manish this is ok,but how i get the phone number and name by use of cursor and give that into simplecursor adopter and finally i set that adopter into listviw and now my query how can i give the photouri to smplecursor adopter , please help
Deletehi manish and one more query,how i can able to display the phone number and name by use of cursor and give that into simplecursor adopter and finally i set that adopter into listview,and i also use the search view for the contact name whatever the user type in the editbox based on i can able to filter and i also display in the listview ,and i am use contextmenu for longpress the contact in that menu have some options then i can able to us thougs options and if i press back button in the device then on resume activity is open but for me the app is crashed and it give error as unable to resume activity..please help
ReplyDeleteHello Manish,
ReplyDeleteAm not getting bitmap image, it showing just like Bitmap.android.graphics.Bitmap@4b84533 .
Please help me
From there you are getting URL only not and bitmap so you have to use Image Donwloader from URL some thing like that-
Deleteprivate Bitmap downloadImage(String url) {
Bitmap bitmap = null;
InputStream stream = null;
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
bmOptions.inSampleSize = 1;
try {
stream = getHttpConnection(url);
bitmap = BitmapFactory.decodeStream(stream, null, bmOptions);
stream.close();
}
catch (IOException e1)
{
e1.printStackTrace();
}
return bitmap;
}
Read more: http://www.androidhub4you.com/2013/09/google-account-integration-in-android.html#ixzz2wKnSyYCY
hi manish can you please tell me how to avoid duplication of numbers in the list. I am able to populate all my contacts in a list view using a custom cursor adapter now i want to just display one number once be it defined as 01234567890 or +911234567890 or 1234567890.
ReplyDeletei just want it to be displayed it once. kindly help
Excellent Tutorial .. I was referring to the official tutorial which was a lot complicated (https://developer.android.com/training/contacts-provider/retrieve-names.html)
ReplyDeleteMeanwhile i forgot to put the while loop in there at first (ie while(cur.moveToNext()) and was getting CursorOutofBoundsException .. After lot of check, i found that the cursor must be moved to first to read from it. Then i realized why the while loop works automatically.. Hope this might help someone stuck with same problem :)
Thanks for your code.
can you plz tell me how to get contact added date and time or last update time when contact modified..
ReplyDeleteI don't think you can get last modified date and time. If you got anything please let me know, i am interested.
Deletehi ramish its work show all the contacts in logCat but it show textview of Xml in android phone please help as soon as possible
ReplyDeleteit should work. please recheck my demo code.
DeleteIf any crash report please share with me.
Thanks!
can you plz tell me if i have 1000 contact in phone then how much tym take to read and write it my local db.........
ReplyDeleteits depend on your data, no one can calculate it.
DeleteI am using mapv2 fragment in XML and use it in fragment.......
ReplyDeletein oncreateview( ) i get it from layout and show correctly.......now when i press back and go to again on fragment its error for duplicate id........so when i search for solving this I found in ondestroyview( ) we release the mapv2 fragment I done this and app running correctly but for a while(1 sec) screen goes to black where map shows .......
I am not getting you. Well create your varaible declaration as private like-
Deleteprivate TextView textView1;
May be it solve your problem.
How to use Mapv2 with tabbar where 2 different tab shown map.....please help
ReplyDeleteIs any exception here? I never try it but it should work.
DeleteYou are trying with action bar tab or old one? If using action bar then just bind your map into fragment.
Hello Brother, i getting error to run the above code in both Android Mobile Phone and also in Emulator...
ReplyDeleteError is: "phone contact detail is stopped"
Try to call readContacts(); method inside Async task class. If you have given permission in manifest and everything ok then only main thread issue might be here so use background thread to get contact detail.
Deletehello, i just want to get all contact name, number or photo of contact in listview.
ReplyDeleteso please help me...???
Hi Thanks for the great Example Manish, I am getting images and contact numbers fine but both are not coming simultaneously.. please help me..
ReplyDeleteBy that im getting image and contact name different.....and while im scrolling list view im getting FC
ReplyDeleteIt's really satisfied.
ReplyDeleteVERY VERY GOOD.
Thanks you
hi everyone
ReplyDeletei implemented this code in my project but its shows only empty page
i got an answer. thanks
ReplyDeleteWorking Code,thanks.But taking around 5 secs to load 100 contacts in my phone.can't something be done to make it fast!!
ReplyDeleteFetching the data from phone will take some time, so till then you can show progress dialog.
Deletesetting android:minSdkVersion to 11 in the manifest file instead of 8 fixed the error
ReplyDeleteThere was problem with contact image. Image work above the version 11. You can make a check in your code over the get uri of image.
Deletehi Manish!
ReplyDeletethis is one awesome tutorial,works like a charm.
now i want to add List view in the same code,have tried but no luck yet :/ Can u help?
thanks in advance :) keep sharing awesome tutorials.
Hi Manish,
ReplyDeleteThe code works fine, I can able to find my contact lists in the Logcat through SOP statements, But I'm wondering why this doesn't appear when I run the application in my mobile.
The o/p occurs as:
......Contact Details....
..................................
.................................
greate example - in my try it fails on "textDetail.setText" do you have any suggestions ?
ReplyDeleteregards
Andrzej
This comment has been removed by the author.
ReplyDeleteHi Manish Srivastava,
ReplyDeleteIam not a programmer, but I would like to have this app (view contacts with name, number and picture).
kindly suggest an app if it is available on google play.
I am creating my app account successfully in device Now i am trying to fetch all contact and show my app name like whats app (which number is register with my app) After searching a lot a I don't get write answer for understanding how its work. Please help
ReplyDeleteStep 1- Get all the phone contact number and their unique Id and send it to server in service class so user did not know about background process.
DeleteStep 2- Server side you need match all the database with your numbers list and return true for which number into your server database and false for other.
Step 3- Now at Android side you need to display that number from your phone book which status is true.
Step 4- And for future if some one add any new contact in their phone book just you need to use broadcast receiver for add new contact and send that contact on server i background and match with server data.
I think that's all you have to do.
Step
dear sir i want to fetch all the phone calls and messages in android app and i want after every 24 hours all detail goes to my mail....hoping best response.
ReplyDeleteLet me clear your doubt first. Actually without user interaction you can't use their email application to send email in background thread. So if you really want to send all detail on email follow below steps-
Delete1)Write a web service for sending all history on server.
2)From server side you can store it into database or you can email all data to any email id.
3)At client side on your phone you need to implement Alarm Manager which will send data to server after every given interval(like 24 hour).
4)And for fetching all history follow below links-
http://www.androidhub4you.com/2014/02/android-sms-history-get-messages-record.html
http://www.androidhub4you.com/2013/09/android-call-history-example-how-to-get.html
Hope it will help you!
but sir using server for fetch mean only for personal use....but i want to make application for all users
Delete1) I install a app in the user mobile
2) fill the email
3) after fill i hide the app
now user dont know all details of there calls and messges come to my mail id
No you are wrong, using server you can access to all users record with their unique phone id and sent it to where you want. You can purchase server email to send email like you revived many email from advertising company so they are using a mail server to send email.
DeleteAnd what you are planning to use phone email and hide the app and all not possible. Android does not allow us to do it for security reason.
Think by yourself if any application like Facebook sending email using your Gmail to anyone is it good thing? Or is it possible? Answer is no.
ok sir thanks but im trying to make spy app like this......thnx for gr8 response :)
DeleteI need to retrieve only device contact please help me
ReplyDeletenot google, nor any other contacts only and only device contact or sim
Deletehave a look at below line-
Deleteif (Integer
.parseInt(cur.getString(cur
.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
}
It will go inside if condition only if contacts have phone number.
but What about images? It's not showing.
ReplyDeleteDid you check below line-
Deleteimage_uri = cur
.getString(cur
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI));
from here you will get the image URI then use image downloader to display them.
Hi Manish,
ReplyDeleteThis awesome tutorial. But if there is a 5000 contacts in a phone , its slow at the first time of loading.I just fetch name and image .but when the size goes to 3000 to 5000, it is slow. can you please give as an idea for fast fetching.
Hi Binil, I never tried with large number of data but I hope Lazy Loading and Async Task should help you.
Delete// Column data from cursor to bind views from
ReplyDeleteString[] columns = new String[]{ContactsContract.CommonDataKinds.Phone.PHOTO_URI, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER};
// View IDs which will have the respective column data inserted
int[] to = new int[]{R.id.contactImage, R.id.name, R.id.number};
SimpleCursorAdapter madapter = new SimpleCursorAdapter(this, R.layout.item_activity, cursor, columns, to, 0);
ListView listView = (ListView) findViewById(R.id.contactList);
listView.setAdapter(madapter);
hi Manish.,
I have the above code. I am trying to display the contact list by sending it to adapter. everything is working fine am getting name,phone no. and image. problem is am not sure how can i place default image. if i dont have image in the contact list. Please help me in this.
Hello Manish....I want to retrieve a single contact from phonebook after verifying whether the MSISDN is 13 digit or not. If its 13 digit only then i can fetch the contact otherwise it wont allow me. Kindly help ....
ReplyDeleteManish Sir..i created.netwebservices to fetch the vehicle details(i,e)id,name,phneno,chasis no..etc from SQL database..i want to fetch these details from webservices ..And details should come within listview while clicking onclick btton .please help me sir..
ReplyDeletebutton button1=(Button)findViewById(R.id.button1);
btton1.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View view) {
ListView = (ListView) findViewById(R.id.listview1);
after which adapter i have to use??????????????????????
please HELPPPP MMEEE sir..
anish Sir..i created.netwebservices to fetch the vehicle details(i,e)id,name,phneno,chasis no..etc from SQL database. webservices details . should come within listview while clicking onclick btton .please help me sir..
ReplyDeletebutton button1=(Button)findViewById(R.id.button1);
btton1.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View view) {
ListView = (ListView) findViewById(R.id.listview1);
after which adapter i have to use??????????????????????
please HELPPPP MMEEE sir..
how to run this in bacground
ReplyDeleteUse Async Task.
DeleteI dont know how to work with Asyn Task..Can u eXplain it
DeleteMr manish i m Making a SPy app for myCollege Project...ANd honestly Speakin I Not well knew about Android..its seem difficulty for me ..i want call detisl and sms details and then so send to mail..but all this should happen in background?...
Deletecan u make a help?
Hi Manish,How to get TYPE(Mobile,Home,Work,Work FAX, Home Fax and Other etc) of mobile number.
ReplyDeletecan anyone help me ...i want to do email task in everyu 1 hour without opening an app...somebody???
ReplyDeletethanks for your useful code
ReplyDeletei have an problem:
when i save the code,these lines are removed by itself "import android.provider.ContactsContract;
import android.widget.TextView;"
and then i got errors for "Contacts" , "CommonDataKinds" , "textDetail"
whats the problem? what should i do???
Please check your package name, it's seems R error. Please check your import for R.java.
DeleteMr Mainsh how to create ap app who record the android screen ?
ReplyDeleteAs per my understanding you can't create a screen recorder app but above version 4.0 you can record your screen using adb command. In this case your phone must be connected with eclipse or android studio. Google for step to record your screen using adb command.
DeleteThanks!
It worked.. Thanks for sharing...
ReplyDeletehow can't share a video file via shareit
ReplyDeletedid you try with text/video?
DeleteHey i have to send all these contacts on a server.and i have to send in json format.
ReplyDeleteCan you tell me how to achieve this task plzzz
public JSONArray readContacts() {
DeleteJSONArray jsonArrayContacts = new JSONArray();
JSONObject jsonContacts = new JSONObject();
try {
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
String phone = 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));
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()) {
phone = pCur
.getString(pCur
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
jsonContacts = new JSONObject();
jsonContacts.put("name", name);
jsonContacts.put("number", phone);
jsonArrayContacts.put(jsonContacts);
}
pCur.close();
}
}
}
} catch (Exception e) {
}
return jsonArrayContacts;
}
hello, Manish, I need android code to send contact details to my email or any other phone number. I would like to help getting this code.
ReplyDelete1) You can't send contact detail direct to email address for this you need to write web-services and then using email server you can send it anywhere.
Delete2)You can send it over the sms in background but there are a lot of contacts and our SMS limit is 160 char so it will charge a lot so think before to implement it.
All the code are above, do what you want to do with it.
Thanks
Manish how to get any type of numbers in the image...
ReplyDeletein the image? I am not getting you. I guess you want use numbers as CHEPTA right? Well you can write number in any textview and you can take screenshot of that programmatically and you can use it where you want.
DeleteHello, Manish Can you help me code to send this contact list as a message to another number. Thanks in advance
ReplyDeleteWell contacts list contain a lot of data so sending them as a message will cost to user. Below is the link you can follow-
Deletehttp://www.androidhub4you.com/2013/10/send-sms-in-background-in-android-send.html
Thanks Manish, the above links works fine, but how can I connect thecontact list code and the send SMS-in background. Thanks in advance
Deletehow can i get the user contacts and save into the file
ReplyDeleteHow can i save the contacts in a file
ReplyDeletehow can i access contacts in another phone? :)
ReplyDeletesir...i was try to run this code but there is exception in this code..i can't handle them..so what i do,
ReplyDeleteHi Manish,
ReplyDeleteI am in search of apple wallet kind of animation for android. Can you please help me out of this.
Link 1 : https://github.com/3lvis/CardStack
Link 2 : https://android-arsenal.com/details/1/3096
It will be very helpful if you can suggest something to achieve wallet kind of animation.
Regards
Ritesh Agrawal
Skype : nm.ritesh
Is there any possibility to get all contacts and emails through one query
ReplyDelete