Here you can find the source of getMy10DigitPhoneNumber(Context ctx)
public static String getMy10DigitPhoneNumber(Context ctx)
//package com.java2s; import android.content.Context; import android.telephony.TelephonyManager; public class Main { public static String getMy10DigitPhoneNumber(Context ctx) { try {//from w ww . j a v a 2 s. c o m String s = getMyPhoneNumber(ctx); return s.substring(2); } catch (Exception e) { return ""; } } public static String getMyPhoneNumber(Context ctx) { try { TelephonyManager mTelephonyMgr; mTelephonyMgr = (TelephonyManager) ctx .getSystemService(Context.TELEPHONY_SERVICE); return mTelephonyMgr.getLine1Number(); } catch (Exception e) { return ""; } } }