Retrieve phone Number in android
<p>This is the following code to retrieve phone number wwas able to get it on samsung 4.0.4, but getting below error on htc one v mobile..any clue?</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

TextView textDeviceID = (TextView)findViewById(R.id.deviceid);


TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);

textDeviceID.setText(getMy10DigitPhoneNumber(telephonyManager));


}
private String getMyPhoneNumber(){
 TelephonyManager mTelephonyMgr;
 mTelephonyMgr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
 return mTelephonyMgr.getLine1Number();
 }

 private String getMy10DigitPhoneNumber(TelephonyManager telephonyManager){
 String s = getMyPhoneNumber();
 return s.substring(0);
 }
}
</code></pre>
