Android studio Ошибка при попытке программно установит id кнопке

@Override
public void onClick(View v) {

switch (v.getId(. {
case R.id.buttonCreate:
LinearLayout.LayoutParams layoutParamsGraviti = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
int btnGravity = Gravity.START;

switch (radioGroup.getCheckedRadioButtonId(. {
case R.id.rbLeft:
btnGravity = Gravity.START;
break;
case R.id.rbCenter:
btnGravity = Gravity.CENTER;
break;
case R.id.rbRight:
btnGravity = Gravity.END;
break;
}
layoutParamsGraviti.gravity = btnGravity;
Button btnNew = new Button(this);

//Здесь пытаюсь задать id = 2 Но почему же ошибка?
btnNew.setId(2);
btnNew.setLayoutParams(layoutParamsGraviti);
btnNew.setText(editText.getText().toString(. ;
linearLayoutOut.addView(btnNew);
break;

ПИШЕТ:
Expected resource of type id less… (Ctrl+F1)
This inspection looks at Android API calls that have been annotated with various support annotations (such as RequiresPermission or UiThread) and flags any calls that are not using the API correctly as specified by the annotations. Examples of errors flagged by this inspection:
Passing the wrong type of resource integer (such as R.string) to an API that expects a different type (such as R.dimen).
Forgetting to invoke the overridden method (via super) in methods that require it
Calling a method that requires a permission without having declared that permission in the manifest
Passing a resource color reference to a method which expects an RGB integer value.