View myView = findViewById(R.id.my_view); myView.setRotation(45);In this example, the View object with the ID "my_view" is retrieved from the layout using the findViewById() method. Then, the setRotation() method is used to rotate the View object by 45 degrees. The setRotation method is a member of the View class, which is part of the android.view package.