Q:

I can insert 10 digit number as input in int or string variable in android.it says an error "integer is too long"

In my case in need give 10 mobile number as input to start a phone intent
Here is my code
    public void dialPhone(View view) {

    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivity(intent);
    }

Please help me .I am just a beginner so please give me somewhat detailed answer

A:

You are getting the error integer is too long error because in Java, the int data type specifies a 32 bit integer, and thus is limited to the minimum and maximum values of -2 147 483 648 and +2 147 483 647 respectively. (See this for more details)
Your phone number most likely exceeds this range of int data type. For this particular problem, you can (and probably should) use the String class for phoneNumber, as that is what the documentation specifies:
Uri parse (String uriString)
Thus, modify your code to make phoneNumber a String object, and it should work without any errors.

