i have code for call action and i need best way to declare run time permission ive tried many codes but i always get error
here is my basic code any suggestion for make it work with runtime permission thanks in advance
public class MainActivity extends Activity {
private Button button;
private EditText etPhoneno;
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    button = (Button) findViewById(R.id.buttonCall);
    etPhoneno = (EditText) findViewById(R.id.editText1);
    // add button listener
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
                String phnum = etPhoneno.getText().toString();
                Intent callIntent = new Intent(Intent.ACTION_CALL);
                callIntent.setData(Uri.parse("tel:" + phnum));
                startActivity(callIntent);
        }
    });
}
}
 
    