Search code examples
androidmobilephone-number

How to show user mobile number into a textbox in android?


I have a textBox(EditText1) in android (Vs-2.3.3)

I want to show my own mobile number (provided my sim is not changed) into the text box.

Is That possible?

Please give the source code if that possible.

Please also tell me what are the prerequisites if possible.

Note : I want to show my own mobile number only , not from contacts.


Solution

  • TelephonyManager tMgr =(TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
    mPhoneNumber = tMgr.getLine1Number();