If the contacts do not have an area code, then you assume that the area code is the local area code. If its the local area code, then the user's phone number must have this area code. Thus, you can get the user's telephone number to determine the local area code and apply that area code to any numbers that do not have an area code.
To get the user's phone number you can use this code -
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String mPhoneNumber = tm.getLine1Number();
Copied from this question.
Then you can extract the area code by looking at the first 3 (or possibly 4 if the length of the String
is 11 char
s) digits.
String areaCode = mPhoneNumer.substring(0, mPhoneNumber.length()==10 ? 3 : 4);
Note: Ensure that you add the READ_PHONE_STATE permission to the AndroidManifest.xml file by adding this line -
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>