I am asking for run time permission. It is asking for the permission and everything is good. But the problem is that the permission dialog is somehow showing outside of the Activity. It close the Activity and then show the dialog of permission. I want that dialog to be show in my activity.

This is my Code

```
 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(activity_main);
    setPasswordText = (EditText) findViewById(R.id.setPasswordText);
    setSecurityText = (EditText) findViewById(R.id.setSecurityText);
    messageToSendText = (EditText) findViewById(R.id.messageToSendText);
    numberToSendText = (EditText) findViewById(R.id.numberToSendText);
    /* if(Build.VERSION.SDK_INT >= 23) {
        if (!Settings.canDrawOverlays(this)) {
            Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                    Uri.parse("package:" + getPackageName()));
            startActivityForResult(intent, 1234);
        }
    }
    else
    {
        Intent intent = new Intent(this, Service.class);
        startService(intent);
    } */

    KING();
}

// @TargetApi(Build.VERSION_CODES.M)
public void KING() {
    // Toast.makeText(this, "Executed", Toast.LENGTH_SHORT).show();
    if (Build.VERSION.SDK_INT >= 23){
        if (checkSelfPermission(Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED) {
            Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
        } else {
            if (shouldShowRequestPermissionRationale(Manifest.permission.SEND_SMS)) {
                Toast.makeText(this, "RECEIVE SMS permission is needed", Toast.LENGTH_LONG).show();
            }
            // Toast.makeText(this, "Permission Not Granted", Toast.LENGTH_SHORT).show();
            requestPermissions(new String[]{Manifest.permission.SEND_SMS}, REQUEST_SEND_SMS);
        }
    }
}

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults){
    if(requestCode == REQUEST_SEND_SMS){
        if(grantResults[0] == PackageManager.PERMISSION_GRANTED){
            Toast.makeText(this, "PERMISSION GRANTED BY YOU", Toast.LENGTH_LONG).show();
        }else{
            Toast.makeText(this, "PERMISSION DENIED BY YOU", Toast.LENGTH_LONG).show();
        }
    }else{
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }
}

```