1
TelephonyManager mt=(TelephonyManager)this.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
             ph=mt.getLine1Number();
            String serial=mt.getSimSerialNumber();
            if(ph.equals(null)){
                txt.setText("serial number is: "+serial );}
            else
                txt.setText("phone Number is "+ph);

in my android manifest file

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

This is my code. And my output is like this phone number is

it wouldn't display my phone number. why so?

Cœur
  • 37,241
  • 25
  • 195
  • 267
xyz
  • 21
  • 2
  • 4
    Possible duplicate of [Programmatically obtain the phone number of the Android phone](http://stackoverflow.com/questions/2480288/programmatically-obtain-the-phone-number-of-the-android-phone) – Dhaval Patel Oct 26 '15 at 04:44

0 Answers0