Search⌘ K

Activity Declaration and Keyboard Support

Understand how to declare the LoginActivity in AndroidManifest.xml and set it as the entry point of your app. Explore keyboard management techniques by making the layout scrollable to prevent UI elements from being hidden. Learn to use inputType attributes to improve user input accuracy and keyboard behavior on the login screen.

Activity declaration #

In the previous lesson, we created activity_login.xml layout. Now it’s time to create LoginActivity class and bind our layout to this activity by using setContentView method.

Java
public class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
}

Android Studio IDE automatically adds @Nullable or @NonNull annotations for overridden methods. These annotations indicate whether parameter or return value can be null or not.

All activities must be registered in AndroidManifest.xml, and because we want LoginActivity to be launched by ...